Options
All
  • Public
  • Public/Protected
  • All
Menu

Class BatchingReceiver

Package version

Describes the batching receiver where the user can receive a specified number of messages for a predefined time.

internal

Hierarchy

Index

Constructors

constructor

Properties

Protected _clearAllMessageLockRenewTimers

_clearAllMessageLockRenewTimers: () => void
property

{Function} _clearMessageLockRenewTimer Clears the message lock renew timer for all the active messages.

Type declaration

    • (): void
    • Returns void

Protected _clearMessageLockRenewTimer

_clearMessageLockRenewTimer: (messageId: string) => void
property

{Function} _clearMessageLockRenewTimer Clears the message lock renew timer for a specific messageId.

Type declaration

    • (messageId: string): void
    • Parameters

      • messageId: string

      Returns void

Protected _context

property

{ClientEntityContext} _context Provides relevant information about the amqp connection, cbs and $management sessions, token provider, sender and receivers.

Protected _deliveryDispositionMap

_deliveryDispositionMap: Map<number, PromiseLike> = new Map<number, PromiseLike>()
property

{Map<number, Promise>} _deliveryDispositionMap Maintains a map of deliveries that are being actively disposed. It acts as a store for correlating the responses received for active dispositions.

Protected _messageRenewLockTimers

_messageRenewLockTimers: Map<string, NodeJS.Timer | undefined> = new Map<string,NodeJS.Timer | undefined>()
property

{Map<string, Function>} _messageRenewLockTimers Maintains a map of messages for which the lock is automatically renewed.

Protected Optional _newMessageReceivedTimer

_newMessageReceivedTimer: NodeJS.Timer
property

{NodeJS.Timer} _newMessageReceivedTimer The timer that keeps track of time since the last message was received.

Protected _onAmqpClose

_onAmqpClose: OnAmqpEventAsPromise
property

{OnAmqpEventAsPromise} _onAmqpClose The message handler that will be set as the handler on the underlying rhea receiver for the "receiver_close" event.

Protected _onAmqpError

_onAmqpError: OnAmqpEvent
property

{OnAmqpEvent} _onAmqpError The message handler that will be set as the handler on the underlying rhea receiver for the "receiver_error" event.

Protected _onAmqpMessage

_onAmqpMessage: OnAmqpEventAsPromise
property

{OnAmqpEventAsPromise} _onAmqpMessage The message handler that will be set as the handler on the underlying rhea receiver for the "message" event.

Protected Optional _onError

_onError: OnError
property

{OnMessage} _onError The error handler provided by the user that will be wrapped inside _onAmqpError.

Protected _onMessage

_onMessage: OnMessage
property

{OnMessage} _onMessage The message handler provided by the user that will be wrapped inside _onAmqpMessage.

Protected _onSessionClose

_onSessionClose: OnAmqpEventAsPromise
property

{OnAmqpEventAsPromise} _onSessionClose The message handler that will be set as the handler on the underlying rhea receiver's session for the "session_close" event.

Protected _onSessionError

_onSessionError: OnAmqpEvent
property

{OnAmqpEvent} _onSessionError The message handler that will be set as the handler on the underlying rhea receiver's session for the "session_error" event.

Protected _onSettled

_onSettled: OnAmqpEvent
property

{OnAmqpEvent} _onSettled The message handler that will be set as the handler on the underlying rhea receiver for the "settled" event.

Protected Optional _receiver

_receiver: Receiver
property

{Receiver} [_receiver] The AMQP receiver link.

Protected Optional _tokenRenewalTimer

_tokenRenewalTimer: NodeJS.Timer
property

{NodeJS.Timer} _tokenRenewalTimer The token renewal timer that keeps track of when the Client Entity is due for token renewal.

Protected Optional _tokenTimeout

_tokenTimeout: undefined | number
property

_tokenTimeout Indicates token timeout

address

address: string
property

{string} address The client entity address in one of the following forms:

Sender

  • "<queue-name>".
  • "<topic-name>".

Receiver

  • "<queue-name>".
  • "<topic-name>".

ManagementClient -"$management".

audience

audience: string
property

{string} audience The client entity token audience in one of the following forms:

Sender

  • "sb://<yournamespace>.servicebus.windows.net/<queue-name>"
  • "sb://<yournamespace>.servicebus.windows.net/<topic-name>"

Receiver

  • "sb://<yournamespace>.servicebus.windows.net/<queue-name>"
  • "sb://<yournamespace>.servicebus.windows.net/<topic-name>"

ManagementClient

  • "sb://<your-namespace>.servicebus.windows.net/<queue-name>/$management".
  • "sb://<your-namespace>.servicebus.windows.net/<topic-name>/$management".

autoComplete

autoComplete: boolean
property

{boolean} autoComplete Indicates whether Message.complete() should be called automatically after the message processing is complete while receiving messages with handlers. Default: false.

autoRenewLock

autoRenewLock: boolean
property

{boolean} autoRenewLock Should lock renewal happen automatically.

isConnecting

isConnecting: boolean = false
property

{boolean} isConnecting Indicates whether the link is in the process of connecting (establishing) itself. Default value: false.

isReceivingMessages

isReceivingMessages: boolean = false
property

Indicates whether the batching receiver has an ongoing receive request that has not been resolved/rejected yet.

maxAutoRenewDurationInMs

maxAutoRenewDurationInMs: number
property

{number} maxAutoRenewDurationInMs The maximum duration within which the lock will be renewed automatically. This value should be greater than the longest message lock duration; for example, the lockDuration property on the received message.

Default: 300 * 1000 (5 minutes);

maxConcurrentCalls

maxConcurrentCalls: number = 1
property

{number} [maxConcurrentCalls] The maximum number of messages that should be processed concurrently while in streaming mode. Once this limit has been reached, more messages will not be received until the user's message handler has completed processing current message. Default: 1

name

name: string
property

{string} id The unique name for the entity in the format: ${name of the entity}-${guid}.

Optional newMessageWaitTimeoutInMs

newMessageWaitTimeoutInMs: undefined | number
property

{number} [newMessageWaitTimeoutInMs] The maximum amount of idle time the receiver will wait after a message has been received. If no messages are received by this time then the receive operation will end.

receiveMode

receiveMode: ReceiveMode
property

{number} [receiveMode] The mode in which messages should be received. Default: ReceiveMode.peekLock

receiverType

receiverType: ReceiverType
property

{string} receiverType The type of receiver: "batching" or "streaming".

Protected resetTimerOnNewMessageReceived

resetTimerOnNewMessageReceived: () => void

Resets the _newMessageReceivedTimer timer when a new message is received.

Type declaration

    • (): void
    • Returns void

Protected Optional wasCloseInitiated

wasCloseInitiated: undefined | false | true
property

{boolean} wasCloseInitiated Denotes if receiver was explicitly closed by user.

Methods

Protected _closeLink

  • _closeLink(link?: AwaitableSender | Receiver): Promise<void>

Protected _createReceiverOptions

  • _createReceiverOptions(useNewName?: undefined | false | true, options?: CreateReceiverOptions): ReceiverOptions

Protected _deleteFromCache

  • _deleteFromCache(): void

Protected _ensureTokenRenewal

  • _ensureTokenRenewal(): Promise<void>

Protected _init

  • _init(options?: ReceiverOptions): Promise<void>

Protected _negotiateClaim

  • _negotiateClaim(setTokenRenewal?: undefined | false | true): Promise<void>

close

  • close(): Promise<void>

isOpen

  • isOpen(): boolean

onDetached

  • onDetached(connectionError?: AmqpError | Error): Promise<void>

receive

  • receive(maxMessageCount: number, maxWaitTimeInMs?: undefined | number): Promise<ServiceBusMessageImpl[]>
  • Receives a batch of messages from a ServiceBus Queue/Topic.

    Parameters

    • maxMessageCount: number

      The maximum number of messages to receive. In Peeklock mode, this number is capped at 2047 due to constraints of the underlying buffer.

    • Optional maxWaitTimeInMs: undefined | number

      The total wait time in milliseconds until which the receiver will attempt to receive specified number of messages. If this time elapses before the maxMessageCount is reached, then messages collected till then will be returned to the user.

    Returns Promise<ServiceBusMessageImpl[]>

    A promise that resolves with an array of Message objects.

settleMessage

  • settleMessage(message: ServiceBusMessageImpl, operation: DispositionType, options?: DispositionStatusOptions): Promise<any>

Static create

Generated using TypeDoc