Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Rabbit

Class representing the RabbitManager object.

Hierarchy

  • Rabbit

Index

Constructors

constructor

Properties

Private conn

conn: null | Connection

Private exchange

exchange: string

Private io

io: Io

Private mgmturl

mgmturl: string

options

options: RabbitOptions

Private pch

pch: Bluebird<Channel>

Private Optional prefix

prefix: string

Private vhost

vhost: string

Methods

_onQueue

_onRpc

  • _onRpc(queueName: string, options: RabbitOnRpcOptions, handler: RpcReplyCallback): Promise<void>
  • Receive RPCs from a queue and handle them.

    Parameters

    Returns Promise<void>

Private _onTopic

  • _onTopic(topic: string, options: RabbitOnTopicOptions, handler: PublishCallback): Promise<Consume>

close

  • close(): Promise<void>

Private encodeContent

  • encodeContent(content: unknown): Buffer

Private getContentType

  • getContentType(content: unknown): string

getQueues

  • getQueues(): Promise<QueueState[]>
  • Get a list of queues declared in the rabbitmq server.

    Returns Promise<QueueState[]>

onQueue

  • onQueue(queueName: string, handler: QueueCallback): Promise<void>
  • onQueue(queueName: string, options: RabbitOnQueueOptions, handler: QueueCallback): Promise<void>

onQueueCreated

  • onQueueCreated(handler: (queue_name: string, properties: MessageProperties) => void): void
  • Subscribe to queue creation events

    Parameters

    • handler: (queue_name: string, properties: MessageProperties) => void

      Callback to handle the event.

        • (queue_name: string, properties: MessageProperties): void
        • Parameters

          • queue_name: string
          • properties: MessageProperties

          Returns void

    Returns void

onQueueDeleted

  • onQueueDeleted(handler: (queue_name: string, properties: MessageProperties) => void): void
  • Subscribe to queue deletion events

    Parameters

    • handler: (queue_name: string, properties: MessageProperties) => void

      Callback to handle the event.

        • (queue_name: string, properties: MessageProperties): void
        • Parameters

          • queue_name: string
          • properties: MessageProperties

          Returns void

    Returns void

onRpc

  • onRpc(queueName: string, handler: RpcReplyCallback): Promise<void>
  • onRpc(queueName: string, options: RabbitOnRpcOptions, handler: RpcReplyCallback): Promise<void>

onTopic

  • onTopic(topic: string, handler: PublishCallback): Promise<Consume>
  • onTopic(topic: string, options: RabbitOnTopicOptions, handler: PublishCallback): Promise<Consume>

Private parseContent

  • parseContent(content: Buffer, content_type?: string): unknown
  • Parameters

    • content: Buffer
    • Optional content_type: string

    Returns unknown

publishRpc

  • publishRpc(queueName: string, content?: unknown, options?: Publish): Promise<RabbitMessage>
  • Make remote procedural call (RPC).

    If options.replyTo is defined, then the promise here will return void immediately after the call is dispatched. This function will also not issue a timeout error under any conditions.

    Parameters

    • queueName: string
    • content: unknown = ...
    • options: Publish = {}

    Returns Promise<RabbitMessage>

publishTopic

  • publishTopic(topic: string, content?: unknown, options?: Publish): Promise<boolean>
  • Publish a message to the specified topic.

    Parameters

    • topic: string

      The routing key for the message.

    • content: unknown = ...

      The message to publish.

    • options: Publish = {}

    Returns Promise<boolean>

Private resolveTopicName

  • resolveTopicName(topic_name: string): string

Generated using TypeDoc