Interface QueueChain<TMessage, TReply>

Type Parameters

  • TMessage

  • TReply

Hierarchy

  • GeneralChainMembers<((state) => QueueChain<TMessage, TReply>)>
  • QueuePublishMethod<TMessage, TReply>
    • QueueChain

Methods

  • Autoack (enabled by default) automatically acks/nacks messages when subscriber callback throws an error or the promise returned from it gets rejected.

    Parameters

    • Optional autoAck: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Autoreply (enabled by default) automatically replies to messages where message callback in subscriber returns a non-undefined value (Only if message has replyTo and a correlationId)

    RPC tutorial

    Parameters

    • Optional autoReply: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Provide a failurebackoff to control the rate of messages in case of errors. Bundled together with haredo comes standardBackoff

    Parameters

    Returns QueueChain<TMessage, TReply>

  • Bind an exchange to the queue.

    For patterns there are two wildcards:

    • * - one word
    • # - zero or more words A word is dot(period) delimited

    Type Parameters

    • TCustomMessage = unknown

    • TCustomReply = unknown

    Parameters

    • exchange: Exchange<TCustomMessage>

      Exchange to bind

    • pattern: string | string[]

      Pattern(s) to use

    Returns QueueChain<MergeTypes<TMessage, TCustomMessage>, MergeTypes<TReply, TCustomReply>>

  • Bind an exchange to the queue.

    For patterns there are two wildcards:

    • * - one word
    • # - zero or more words A word is dot(period) delimited

    Parameters

    • exchangeName: string

      name of the exchange

    • pattern: string | string[]

      pattern(s) to bind

    • exchangeType: ExchangeType

      Type of the exchange

    • Optional exchangeOpts: ExchangeOptions

      Options to use for asserting the exchange

    Returns QueueChain<TMessage, TReply>

  • Bind an exchange to the queue.

    For patterns there are two wildcards:

    • * - one word
    • # - zero or more words A word is dot(period) delimited

    Type Parameters

    • TCustomMessage = unknown

    • TCustomReply = unknown

    Parameters

    • exchange: string

      Name of the exchange to bind

    • pattern: string | string[]

      Pattern(s) to use

    • type: ExchangeType

      Type of the exchange

    • Optional opts: Partial<ExchangeOptions>

      Options to pass to amqplib for asserting

    Returns QueueChain<MergeTypes<TMessage, TCustomMessage>, MergeTypes<TReply, TCustomReply>>

  • Set prefetch count for consuming (ie. amount of messages that will be received in parallel) 0 Means there is no limit.

    Aliased to .prefetch

    Parameters

    • concurrency: number

      number of concurrent messages passed to .subscribe callbacks

    Returns QueueChain<TMessage, TReply>

  • Enable publishing using ConfirmChannels

    See RabbitMq Docs

    Parameters

    • Optional confirm: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • When exclusive is set to true, the broker won't allow anyone else consume from this queue

    Parameters

    • Optional exclusive: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Return the state of the chain for inspection

    Returns Partial<HaredoChainState<TMessage, unknown>>

  • Enable json mode (it's enabled by default). When json is enabled, messages that are published without using prepared message objects will be passed through JSON.stringify. When subscribing message data will be run through JSON.parse

    Parameters

    • Optional json: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Enable noAck on the consumer. When noAck is set the broker will dequeue messages when they are sent down the wire.

    Parameters

    • Optional noAck: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Set prefetch count for consuming (ie. amount of messages that will be received in parallel) 0 Means there is no limit.

    Aliased to .concurrency

    Parameters

    • prefetch: number

      number of messages to prefetch

    Returns QueueChain<TMessage, TReply>

  • Set the consumer priority. Lower priority consumers will receive messages only when higher priority consumers are busy.

    Requires Consumer priorities extension to be enabled

    Parameters

    • priority: number

    Returns QueueChain<TMessage, TReply>

  • Parameters

    • message: string | TMessage | MessageChain<TMessage>
    • Optional publishOpts: Publish

    Returns Promise<void>

  • Reestablish a subscriber when channel / connection closes (enabled by default)

    Parameters

    • Optional reestablish: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Parameters

    • message: string | TMessage | MessageChain<TMessage>
    • Optional publishOpts: Publish

    Returns Promise<TReply>

  • Assert / Bind exchanges/queues. Will be skipped if skipSetup is set in the chain

    Returns Promise<void>

  • Don't run automatic setup. Useful for faster publishing.

    Parameters

    • Optional skipSetup: boolean

      defaults to true

    Returns QueueChain<TMessage, TReply>

  • Subscribe to messages in the queue specified in the chain

    Type Parameters

    • TCustomMessage

    • TCustomReply

    Parameters

    • cb: MessageCallback<MergeTypes<TMessage, TCustomMessage>, MergeTypes<TReply, TCustomReply>>

    Returns Promise<Consumer>

Generated using TypeDoc