Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RabbitMQClient

Hierarchy

  • RabbitMQClient

Index

Methods

addConfirmListener

  • Add a Confirm Listener to the channel. Note that this will automatically call confirmSelect, it is not necessary to call that too.

    Parameters

    • maxQueueSize: number

    Returns PromiseLike<ReadStream<RabbitMQConfirmation>>

  • Add a Confirm Listener to the channel. Note that this will automatically call confirmSelect, it is not necessary to call that too.

    Parameters

    Returns void

basicAck

  • basicAck(deliveryTag: number, multiple: boolean): PromiseLike<void>
  • basicAck(deliveryTag: number, multiple: boolean, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Acknowledge one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being acknowledged.

    Parameters

    • deliveryTag: number
    • multiple: boolean

    Returns PromiseLike<void>

  • Acknowledge one or several received messages. Supply the deliveryTag from the AMQP.Basic.GetOk or AMQP.Basic.Deliver method containing the received message being acknowledged.

    Parameters

    • deliveryTag: number
    • multiple: boolean
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

basicConsumer

  • Parameters

    • queue: string

    Returns PromiseLike<RabbitMQConsumer>

  • Parameters

    Returns void

  • Create a consumer with the given options.

    Parameters

    Returns PromiseLike<RabbitMQConsumer>

  • Create a consumer with the given options.

    Parameters

    Returns void

basicGet

  • Retrieve a message from a queue using AMQP.Basic.Get

    Parameters

    • queue: string
    • autoAck: boolean

    Returns PromiseLike<RabbitMQMessage>

  • Retrieve a message from a queue using AMQP.Basic.Get

    Parameters

    Returns void

basicNack

  • basicNack(deliveryTag: number, multiple: boolean, requeue: boolean): PromiseLike<void>
  • basicNack(deliveryTag: number, multiple: boolean, requeue: boolean, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Reject one or several received messages.

    Parameters

    • deliveryTag: number
    • multiple: boolean
    • requeue: boolean

    Returns PromiseLike<void>

  • Reject one or several received messages.

    Parameters

    • deliveryTag: number
    • multiple: boolean
    • requeue: boolean
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

basicPublish

  • basicPublish(exchange: string, routingKey: string, body: Buffer): PromiseLike<void>
  • basicPublish(exchange: string, routingKey: string, body: Buffer, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • basicPublish(exchange: string, routingKey: string, properties: any, body: Buffer): PromiseLike<void>
  • basicPublish(exchange: string, routingKey: string, properties: any, body: Buffer, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    Parameters

    • exchange: string
    • routingKey: string
    • body: Buffer

    Returns PromiseLike<void>

  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    Parameters

    • exchange: string
    • routingKey: string
    • body: Buffer
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    Parameters

    • exchange: string
    • routingKey: string
    • properties: any
    • body: Buffer

    Returns PromiseLike<void>

  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    Parameters

    • exchange: string
    • routingKey: string
    • properties: any
    • body: Buffer
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

basicPublishWithDeliveryTag

  • basicPublishWithDeliveryTag(exchange: string, routingKey: string, properties: any, body: Buffer, deliveryTagHandler: ((res: number) => void) | Handler<number> | null | undefined): PromiseLike<void>
  • basicPublishWithDeliveryTag(exchange: string, routingKey: string, properties: any, body: Buffer, deliveryTagHandler: ((res: number) => void) | Handler<number> | null | undefined, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    The deliveryTagHandler will be called before the message is sent, which is necessary because the confirmation may arrive asynchronously before the resultHandler is called.

    Parameters

    • exchange: string
    • routingKey: string
    • properties: any
    • body: Buffer
    • deliveryTagHandler: ((res: number) => void) | Handler<number> | null | undefined

    Returns PromiseLike<void>

  • Publish a message. Publishing to a non-existent exchange will result in a channel-level protocol exception, which closes the channel. Invocations of Channel#basicPublish will eventually block if a resource-driven alarm is in effect.

    The deliveryTagHandler will be called before the message is sent, which is necessary because the confirmation may arrive asynchronously before the resultHandler is called.

    Parameters

    • exchange: string
    • routingKey: string
    • properties: any
    • body: Buffer
    • deliveryTagHandler: ((res: number) => void) | Handler<number> | null | undefined
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

basicQos

  • basicQos(prefetchCount: number): PromiseLike<void>
  • basicQos(prefetchCount: number, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • basicQos(prefetchCount: number, global: boolean): PromiseLike<void>
  • basicQos(prefetchCount: number, global: boolean, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • basicQos(prefetchSize: number, prefetchCount: number, global: boolean): PromiseLike<void>
  • basicQos(prefetchSize: number, prefetchCount: number, global: boolean, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Request a specific prefetchCount "quality of service" settings for this channel.

    Parameters

    • prefetchCount: number

    Returns PromiseLike<void>

  • Request a specific prefetchCount "quality of service" settings for this channel.

    Parameters

    • prefetchCount: number
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Request a specific prefetchCount "quality of service" settings for this channel.

    Parameters

    • prefetchCount: number
    • global: boolean

    Returns PromiseLike<void>

  • Request a specific prefetchCount "quality of service" settings for this channel.

    Parameters

    • prefetchCount: number
    • global: boolean
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Request specific "quality of service" settings.

    These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.

    Parameters

    • prefetchSize: number
    • prefetchCount: number
    • global: boolean

    Returns PromiseLike<void>

  • Request specific "quality of service" settings.

    These settings impose limits on the amount of data the server will deliver to consumers before requiring acknowledgements. Thus they provide a means of consumer-initiated flow control.

    Parameters

    • prefetchSize: number
    • prefetchCount: number
    • global: boolean
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

confirmSelect

  • confirmSelect(): PromiseLike<void>
  • confirmSelect(resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Enables publisher acknowledgements on this channel. Can be called once during client initialisation. Calls to basicPublish() will have to be confirmed.

    Returns PromiseLike<void>

  • Enables publisher acknowledgements on this channel. Can be called once during client initialisation. Calls to basicPublish() will have to be confirmed.

    Parameters

    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

exchangeBind

  • exchangeBind(destination: string, source: string, routingKey: string): PromiseLike<void>
  • exchangeBind(destination: string, source: string, routingKey: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • exchangeBind(destination: string, source: string, routingKey: string, arguments: {}): PromiseLike<void>
  • exchangeBind(destination: string, source: string, routingKey: string, arguments: {}, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Bind an exchange to an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string

    Returns PromiseLike<void>

  • Bind an exchange to an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Bind an exchange to an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any

    Returns PromiseLike<void>

  • Bind an exchange to an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

exchangeDeclare

  • exchangeDeclare(exchange: string, type: string, durable: boolean, autoDelete: boolean): PromiseLike<void>
  • exchangeDeclare(exchange: string, type: string, durable: boolean, autoDelete: boolean, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • exchangeDeclare(exchange: string, type: string, durable: boolean, autoDelete: boolean, config: {}): PromiseLike<void>
  • exchangeDeclare(exchange: string, type: string, durable: boolean, autoDelete: boolean, config: {}, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Declare an exchange.

    Parameters

    • exchange: string
    • type: string
    • durable: boolean
    • autoDelete: boolean

    Returns PromiseLike<void>

  • Declare an exchange.

    Parameters

    • exchange: string
    • type: string
    • durable: boolean
    • autoDelete: boolean
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.

    Parameters

    • exchange: string
    • type: string
    • durable: boolean
    • autoDelete: boolean
    • config: {}
      • [key: string]: any

    Returns PromiseLike<void>

  • Declare an exchange with additional parameters such as dead lettering, an alternate exchange or TTL.

    Parameters

    • exchange: string
    • type: string
    • durable: boolean
    • autoDelete: boolean
    • config: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

exchangeDelete

  • exchangeDelete(exchange: string): PromiseLike<void>
  • exchangeDelete(exchange: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Delete an exchange, without regard for whether it is in use or not.

    Parameters

    • exchange: string

    Returns PromiseLike<void>

  • Delete an exchange, without regard for whether it is in use or not.

    Parameters

    • exchange: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

exchangeUnbind

  • exchangeUnbind(destination: string, source: string, routingKey: string): PromiseLike<void>
  • exchangeUnbind(destination: string, source: string, routingKey: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • exchangeUnbind(destination: string, source: string, routingKey: string, arguments: {}): PromiseLike<void>
  • exchangeUnbind(destination: string, source: string, routingKey: string, arguments: {}, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Unbind an exchange from an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string

    Returns PromiseLike<void>

  • Unbind an exchange from an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Unbind an exchange from an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any

    Returns PromiseLike<void>

  • Unbind an exchange from an exchange.

    Parameters

    • destination: string
    • source: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

isConnected

  • isConnected(): boolean
  • Check if a connection is open

    Returns boolean

isOpenChannel

  • isOpenChannel(): boolean
  • Check if a channel is open

    Returns boolean

messageCount

  • messageCount(queue: string): PromiseLike<number>
  • messageCount(queue: string, resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>): void
  • Returns the number of messages in a queue ready to be delivered.

    Parameters

    • queue: string

    Returns PromiseLike<number>

  • Returns the number of messages in a queue ready to be delivered.

    Parameters

    • queue: string
    • resultHandler: ((res: AsyncResult<number>) => void) | Handler<AsyncResult<number>>

    Returns void

queueBind

  • queueBind(queue: string, exchange: string, routingKey: string): PromiseLike<void>
  • queueBind(queue: string, exchange: string, routingKey: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • queueBind(queue: string, exchange: string, routingKey: string, arguments: {}): PromiseLike<void>
  • queueBind(queue: string, exchange: string, routingKey: string, arguments: {}, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Bind a queue to an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string

    Returns PromiseLike<void>

  • Bind a queue to an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Bind a queue to an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any

    Returns PromiseLike<void>

  • Bind a queue to an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

queueDeclare

  • queueDeclare(queue: string, durable: boolean, exclusive: boolean, autoDelete: boolean): PromiseLike<any>
  • queueDeclare(queue: string, durable: boolean, exclusive: boolean, autoDelete: boolean, resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>): void
  • queueDeclare(queue: string, durable: boolean, exclusive: boolean, autoDelete: boolean, config: {}): PromiseLike<any>
  • queueDeclare(queue: string, durable: boolean, exclusive: boolean, autoDelete: boolean, config: {}, resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>): void
  • Declare a queue

    Parameters

    • queue: string
    • durable: boolean
    • exclusive: boolean
    • autoDelete: boolean

    Returns PromiseLike<any>

  • Declare a queue

    Parameters

    • queue: string
    • durable: boolean
    • exclusive: boolean
    • autoDelete: boolean
    • resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>

    Returns void

  • Declare a queue with config options

    Parameters

    • queue: string
    • durable: boolean
    • exclusive: boolean
    • autoDelete: boolean
    • config: {}
      • [key: string]: any

    Returns PromiseLike<any>

  • Declare a queue with config options

    Parameters

    • queue: string
    • durable: boolean
    • exclusive: boolean
    • autoDelete: boolean
    • config: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>

    Returns void

queueDeclareAuto

  • queueDeclareAuto(): PromiseLike<{}>
  • queueDeclareAuto(resultHandler: ((res: AsyncResult<{}>) => void) | Handler<AsyncResult<{}>>): void
  • Actively declare a server-named exclusive, autodelete, non-durable queue.

    Returns PromiseLike<{}>

  • Actively declare a server-named exclusive, autodelete, non-durable queue.

    Parameters

    • resultHandler: ((res: AsyncResult<{}>) => void) | Handler<AsyncResult<{}>>

    Returns void

queueDelete

  • queueDelete(queue: string): PromiseLike<any>
  • queueDelete(queue: string, resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>): void
  • Delete a queue, without regard for whether it is in use or has messages on it

    Parameters

    • queue: string

    Returns PromiseLike<any>

  • Delete a queue, without regard for whether it is in use or has messages on it

    Parameters

    • queue: string
    • resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>

    Returns void

queueDeleteIf

  • queueDeleteIf(queue: string, ifUnused: boolean, ifEmpty: boolean): PromiseLike<any>
  • queueDeleteIf(queue: string, ifUnused: boolean, ifEmpty: boolean, resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>): void
  • Delete a queue

    Parameters

    • queue: string
    • ifUnused: boolean
    • ifEmpty: boolean

    Returns PromiseLike<any>

  • Delete a queue

    Parameters

    • queue: string
    • ifUnused: boolean
    • ifEmpty: boolean
    • resultHandler: ((res: AsyncResult<any>) => void) | Handler<AsyncResult<any>>

    Returns void

queueUnbind

  • queueUnbind(queue: string, exchange: string, routingKey: string): PromiseLike<void>
  • queueUnbind(queue: string, exchange: string, routingKey: string, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • queueUnbind(queue: string, exchange: string, routingKey: string, arguments: {}): PromiseLike<void>
  • queueUnbind(queue: string, exchange: string, routingKey: string, arguments: {}, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Unbind a queue from an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string

    Returns PromiseLike<void>

  • Unbind a queue from an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Unbind a queue from an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any

    Returns PromiseLike<void>

  • Unbind a queue from an exchange

    Parameters

    • queue: string
    • exchange: string
    • routingKey: string
    • arguments: {}
      • [key: string]: any
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

restartConnect

  • restartConnect(attempts: number): PromiseLike<void>
  • restartConnect(attempts: number, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • restart the rabbitMQ connect.

    Parameters

    • attempts: number

    Returns PromiseLike<void>

  • restart the rabbitMQ connect.

    Parameters

    • attempts: number
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

start

  • start(): PromiseLike<void>
  • start(resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Start the rabbitMQ client. Create the connection and the channel.

    Returns PromiseLike<void>

  • Start the rabbitMQ client. Create the connection and the channel.

    Parameters

    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

stop

  • stop(): PromiseLike<void>
  • stop(resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Stop the rabbitMQ client. Close the connection and its channel.

    Returns PromiseLike<void>

  • Stop the rabbitMQ client. Close the connection and its channel.

    Parameters

    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

waitForConfirms

  • waitForConfirms(): PromiseLike<void>
  • waitForConfirms(resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • waitForConfirms(timeout: number): PromiseLike<void>
  • waitForConfirms(timeout: number, resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>): void
  • Wait until all messages published since the last call have been either ack'd or nack'd by the broker. This will incur slight performance loss at the expense of higher write consistency. If desired, multiple calls to basicPublish() can be batched before confirming.

    Returns PromiseLike<void>

  • Wait until all messages published since the last call have been either ack'd or nack'd by the broker. This will incur slight performance loss at the expense of higher write consistency. If desired, multiple calls to basicPublish() can be batched before confirming.

    Parameters

    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

  • Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown.

    Parameters

    • timeout: number

    Returns PromiseLike<void>

  • Wait until all messages published since the last call have been either ack'd or nack'd by the broker; or until timeout elapses. If the timeout expires a TimeoutException is thrown.

    Parameters

    • timeout: number
    • resultHandler: ((res: AsyncResult<void>) => void) | Handler<AsyncResult<void>>

    Returns void

Static create

  • Create and return a client configured with the default options.

    Parameters

    • vertx: Vertx

    Returns RabbitMQClient

  • Create and return a client.

    Parameters

    Returns RabbitMQClient

Generated using TypeDoc