Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface ServiceBusReceiver<ReceivedMessageT>

Package version

A receiver that does not handle sessions.

Type parameters

  • ReceivedMessageT

Hierarchy

Index

Properties

entityPath

entityPath: string

Path of the entity for which the receiver has been created.

isClosed

isClosed: boolean
property

Returns true if either the receiver or the client that created it has been closed

readonly

receiveMode

receiveMode: "peekLock" | "receiveAndDelete"

ReceiveMode provided to the client.

Methods

close

  • close(): Promise<void>

getMessageIterator

  • Returns an iterator that can be used to receive messages from Service Bus. If the iterator is not able to fetch a new message in over a minute, undefined will be returned.

    throws

    Error if the underlying connection, client or receiver is closed.

    throws

    Error if current receiver is already in state of receiving messages.

    throws

    MessagingError if the service returns an error while receiving messages.

    Parameters

    • Optional options: GetMessageIteratorOptions

      A set of options to control the receive operation.

      • maxWaitTimeInMs: The time to wait to receive the message in each iteration.
      • abortSignal: The signal to use to abort the ongoing operation.

    Returns AsyncIterableIterator<ReceivedMessageT>

peekMessages

  • Peek the next batch of active messages (including deferred but not deadlettered messages) on the queue or subscription without modifying them.

    • The first call to peekMessages() fetches the first active message. Each subsequent call fetches the subsequent message.
    • Unlike a "received" message, "peeked" message is a read-only version of the message. It cannot be Completed/Abandoned/Deferred/Deadlettered.

    Parameters

    • maxMessageCount: number

      The maximum number of messages to peek.

    • Optional options: PeekMessagesOptions

      Options that allow to specify the maximum number of messages to peek, the sequenceNumber to start peeking from or an abortSignal to abort the operation.

    Returns Promise<ServiceBusReceivedMessage[]>

receiveDeferredMessages

  • receiveDeferredMessages(sequenceNumbers: Long | Long[], options?: OperationOptionsBase): Promise<ReceivedMessageT[]>
  • Returns a promise that resolves to an array of deferred messages identified by given sequenceNumbers.

    throws

    Error if the underlying connection or receiver is closed.

    throws

    MessagingError if the service returns an error while receiving deferred messages.

    Parameters

    • sequenceNumbers: Long | Long[]

      The sequence number or an array of sequence numbers for the messages that need to be received.

    • Optional options: OperationOptionsBase

      Options bag to pass an abort signal or tracing options.

    Returns Promise<ReceivedMessageT[]>

    • Returns a list of messages identified by the given sequenceNumbers.
    • Returns an empty list if no messages are found.

receiveMessages

  • Returns a promise that resolves to an array of messages received from Service Bus.

    throws

    Error if the underlying connection, client or receiver is closed.

    throws

    Error if current receiver is already in state of receiving messages.

    throws

    MessagingError if the service returns an error while receiving messages.

    Parameters

    • maxMessageCount: number

      The maximum number of messages to receive.

    • Optional options: ReceiveMessagesOptions

      A set of options to control the receive operation.

      • maxWaitTimeInMs: The maximum time to wait for the first message before returning an empty array if no messages are available.
      • abortSignal: The signal to use to abort the ongoing operation.

    Returns Promise<ReceivedMessageT[]>

    Promise<ReceivedMessageT[]> A promise that resolves with an array of messages.

subscribe

Generated using TypeDoc