Closes the underlying AMQP receiver link.
Once closed, the receiver cannot be used for any further operations.
Use the createReceiver
function on the QueueClient or SubscriptionClient to instantiate
a new Receiver
Gets an async iterator over messages from the receiver.
Throws an error if there is another receive operation in progress on the same receiver. If you
are not sure whether there is another receive operation running, check the isReceivingMessages
property on the receiver.
If the iterator is not able to fetch a new message in over a minute, undefined
will be returned
Gets the state of the Session. For more on session states, see Session State
Promise
Indicates whether the receiver is currently receiving messages or not.
When this returns true, new registerMessageHandler()
or receiveMessages()
calls cannot be made.
Fetches the next batch of active messages (including deferred but not deadlettered messages) in the current session.
peek()
fetches the first active message. Each subsequent call fetches the
subsequent message.received
message, peeked
message is a read-only version of the message.
It cannot be Completed/Abandoned/Deferred/Deadlettered
. The lock on it cannot be renewed.The maximum number of messages to peek. Default value 1
.
Promise<ReceivedMessageInfo[]>
Peeks the desired number of active messages (including deferred but not deadlettered messages) from the specified sequence number in the current session.
received
message, peeked
message is a read-only version of the message.
It cannot be Completed/Abandoned/Deferred/Deadlettered
. The lock on it cannot be renewed.The sequence number from where to read the message.
Promise<ReceivedSBMessage[]>
Returns a promise that resolves to a deferred message identified by the given sequenceNumber
.
The sequence number of the message that needs to be received.
Promise<ServiceBusMessage | undefined>
Message
identified by sequence number.undefined
if no such message is found.Returns a promise that resolves to an array of deferred messages identified by given sequenceNumbers
.
An array of sequence numbers for the messages that need to be received.
Promise<ServiceBusMessage[]>
Returns a promise that resolves to an array of messages based on given count and timeout over an AMQP receiver link from a Queue/Subscription.
Throws an error if there is another receive operation in progress on the same receiver. If you
are not sure whether there is another receive operation running, check the isReceivingMessages
property on the receiver.
The maximum number of messages to receive from Queue/Subscription.
The total wait time in seconds 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.
60
seconds.Promise<ServiceBusMessage[]> A promise that resolves with an array of Message objects.
Registers handlers to deal with the incoming stream of messages over an AMQP receiver link
from a Queue/Subscription.
To stop receiving messages, call close()
on the SessionReceiver.
Throws an error if there is another receive operation in progress on the same receiver. If you
are not sure whether there is another receive operation running, check the isReceivingMessages
property on the receiver.
Handler for processing each incoming message.
Handler for any error that occurs while receiving or processing messages.
Options to control whether messages should be automatically completed or if the lock on the session should be automatically renewed. You can control the maximum number of messages that should be concurrently processed. You can also provide a timeout in seconds to denote the amount of time to wait for a new message before closing the receiver.
void
Renews the lock on the session for the duration as specified during the Queue/Subscription creation.
sessionLockedUntilUtc
property on the SessionReceiver for the time when the lock expires.complete()
, defer()
or deadletter()
,
before the session lock expires, then the message lands back in the Queue/Subscription for the next
receive operation.Promise
Sets the state on the Session. For more on session states, see Session State
The state that needs to be set.
Generated using TypeDoc
The SessionReceiver class can be used to receive messages from a session enabled Queue or Subscription in a batch or by registering handlers. Use the
createReceiver
function on the QueueClient or SubscriptionClient to instantiate a SessionReceiver. The SessionReceiver class is an abstraction over the underlying AMQP receiver link.