IMessageReceiver Interface

Implements

public interface IMessageReceiver
extends IMessageEntityClient, IMessageBrowser

Defines message receiver interface. The MessageReceiver can be used to receive messages from Queues and Subscriptions and acknowledge them.

Method Summary

Modifier and Type Method and Description
abstract void abandon(UUID lockToken)

Abandon Message with lock token.

abstract void abandon(UUID lockToken, TransactionContext transaction)

Abandon Message with lock token.

abstract void abandon(UUID lockToken, Map<String,Object> propertiesToModify)

Abandon Message with lock token and updated message property.

abstract void abandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Abandon Message with lock token and updated message property.

abstract CompletableFuture<Void> abandonAsync(UUID lockToken)

Asynchronously abandon Message with lock token.

abstract CompletableFuture<Void> abandonAsync(UUID lockToken, TransactionContext transaction)

Asynchronously abandon Message with lock token.

abstract CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)

Asynchronously abandon Message with lock token and updated message property.

abstract CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Asynchronously abandon Message with lock token and updated message property.

abstract void complete(UUID lockToken)

Completes a Message using its lock token.

abstract void complete(UUID lockToken, TransactionContext transaction)

Completes a Message using its lock token.

abstract CompletableFuture<Void> completeAsync(UUID lockToken)

Asynchronously completes a Message using its lock token.

abstract CompletableFuture<Void> completeAsync(UUID lockToken, TransactionContext transaction)

Asynchronously completes a Message using its lock token.

abstract void deadLetter(UUID lockToken)

Moves a Message to the deadletter sub-queue.

abstract void deadLetter(UUID lockToken, TransactionContext transaction)

Moves a Message to the deadletter sub-queue.

abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Moves a Message to the deadletter sub-queue with deadletter reason and error description.

abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with deadletter reason and error description.

abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)

Moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

abstract void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify)

Moves a Message to the deadletter sub-queue with modified message properties.

abstract void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with modified message properties.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken)

Asynchronously moves a Message to the deadletter sub-queue with deadletter.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify)

Asynchronously moves a Message to the deadletter sub-queue with modified properties.

abstract CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with modified properties.

abstract void defer(UUID lockToken)

Defers a Message using its lock token.

abstract void defer(UUID lockToken, TransactionContext transaction)

Defers a Message using its lock token.

abstract void defer(UUID lockToken, Map<String,Object> propertiesToModify)

Defers a Message using its lock token with modified message property.

abstract void defer(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Defers a Message using its lock token with modified message property.

abstract CompletableFuture<Void> deferAsync(UUID lockToken)

Asynchronously defers a Message using its lock token.

abstract CompletableFuture<Void> deferAsync(UUID lockToken, TransactionContext transaction)

Asynchronously defers a Message using its lock token.

abstract CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify)

Asynchronously defers a Message using its lock token with modified message propert.

abstract CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)

Asynchronously defers a Message using its lock token with modified message propert.

abstract int getPrefetchCount()

Get the prefetch value set.

abstract ReceiveMode getReceiveMode()

Get current receiver's ReceiveMode.

abstract IMessage receive()

Receives a Message with default server wait time.

abstract IMessage receive(Duration serverWaitTime)

Receives a Message with specified server wait time.

abstract CompletableFuture<IMessage> receiveAsync()

Receives a Message from Azure Service Bus.

abstract CompletableFuture<IMessage> receiveAsync(Duration serverWaitTime)

Receives a Message from Azure Service Bus with server wait time.

abstract Collection<IMessage> receiveBatch(int maxMessageCount)

Receives a maximum of maxMessageCount Message from Azure Service Bus.

abstract Collection<IMessage> receiveBatch(int maxMessageCount, Duration serverWaitTime)

Receives a maximum of maxMessageCount Message from Azure Service Bus with server wait time.

abstract CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount)

Asynchronously receives a maximum of maxMessageCount Message from the entity.

abstract CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount, Duration serverWaitTime)

Asynchronously receives a maximum of maxMessageCount Message from Azure Service Bus with server wait time.

abstract IMessage receiveDeferredMessage(long sequenceNumber)

Receives a deferred Message.

abstract CompletableFuture<IMessage> receiveDeferredMessageAsync(long sequenceNumber)

Asynchronously receives a specific deferred Message identified by sequence number.

abstract Collection<IMessage> receiveDeferredMessageBatch(Collection<Long> sequenceNumbers)

Receives a batch of deferred Message.

abstract CompletableFuture<Collection<IMessage>> receiveDeferredMessageBatchAsync(Collection<Long> sequenceNumbers)

Asynchronously receives a set of deferred Message from the entity.

abstract Instant renewMessageLock(IMessage message)

Renews the lock on the message specified by the lock token.

abstract Instant renewMessageLock(UUID lockToken)

Renews the lock on the message specified by the lock token.

abstract CompletableFuture<Instant> renewMessageLockAsync(IMessage message)

Asynchronously renews the lock on the message specified by the lock token.

abstract CompletableFuture<Instant> renewMessageLockAsync(UUID lockToken)

Renews the lock on the message specified by the lock token.

abstract void setPrefetchCount(int prefetchCount)

Set the prefetch count of the receiver.

Method Details

abandon

public abstract void abandon(UUID lockToken)

Abandon Message with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message

Parameters:

lockToken - Message lock token getLockToken()

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

abandon

public abstract void abandon(UUID lockToken, TransactionContext transaction)

Abandon Message with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

abandon

public abstract void abandon(UUID lockToken, Map propertiesToModify)

Abandon Message with lock token and updated message property. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

abandon

public abstract void abandon(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Abandon Message with lock token and updated message property. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

abandonAsync

public abstract CompletableFuture abandonAsync(UUID lockToken)

Asynchronously abandon Message with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

a CompletableFuture representing the pending abandon.

abandonAsync

public abstract CompletableFuture abandonAsync(UUID lockToken, TransactionContext transaction)

Asynchronously abandon Message with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending abandon.

abandonAsync

public abstract CompletableFuture abandonAsync(UUID lockToken, Map propertiesToModify)

Asynchronously abandon Message with lock token and updated message property. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Returns:

a CompletableFuture representing the pending abandon.

abandonAsync

public abstract CompletableFuture abandonAsync(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Asynchronously abandon Message with lock token and updated message property. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending abandon.

complete

public abstract void complete(UUID lockToken)

Completes a Message using its lock token. This will delete the message from the service.

Parameters:

lockToken - Message lock token getLockToken()

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

complete

public abstract void complete(UUID lockToken, TransactionContext transaction)

Completes a Message using its lock token. This will delete the message from the service.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

completeAsync

public abstract CompletableFuture completeAsync(UUID lockToken)

Asynchronously completes a Message using its lock token. This will delete the message from the service.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

a CompletableFuture representing the pending complete.

completeAsync

public abstract CompletableFuture completeAsync(UUID lockToken, TransactionContext transaction)

Asynchronously completes a Message using its lock token. This will delete the message from the service.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending complete.

deadLetter

public abstract void deadLetter(UUID lockToken)

Moves a Message to the deadletter sub-queue.

Parameters:

lockToken - Message lock token getLockToken()

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, TransactionContext transaction)

Moves a Message to the deadletter sub-queue.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Moves a Message to the deadletter sub-queue with deadletter reason and error description.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with deadletter reason and error description.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify)

Moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
propertiesToModify - Message properties to modify.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, Map propertiesToModify)

Moves a Message to the deadletter sub-queue with modified message properties.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetter

public abstract void deadLetter(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Moves a Message to the deadletter sub-queue with modified message properties.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken)

Asynchronously moves a Message to the deadletter sub-queue with deadletter.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
propertiesToModify - Message properties to modify.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map propertiesToModify, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with deadletter reason and error description and modified properties.

Parameters:

lockToken - Message lock token getLockToken()
deadLetterReason - The deadletter reason.
deadLetterErrorDescription - The deadletter error description.
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, Map propertiesToModify)

Asynchronously moves a Message to the deadletter sub-queue with modified properties.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Returns:

a CompletableFuture representing the pending deadletter.

deadLetterAsync

public abstract CompletableFuture deadLetterAsync(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Asynchronously moves a Message to the deadletter sub-queue with modified properties.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending deadletter.

defer

public abstract void defer(UUID lockToken)

Defers a Message using its lock token. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

defer

public abstract void defer(UUID lockToken, TransactionContext transaction)

Defers a Message using its lock token. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

defer

public abstract void defer(UUID lockToken, Map propertiesToModify)

Defers a Message using its lock token with modified message property. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

defer

public abstract void defer(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Defers a Message using its lock token with modified message property. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

deferAsync

public abstract CompletableFuture deferAsync(UUID lockToken)

Asynchronously defers a Message using its lock token. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

a CompletableFuture representing the pending defer.

deferAsync

public abstract CompletableFuture deferAsync(UUID lockToken, TransactionContext transaction)

Asynchronously defers a Message using its lock token. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending defer.

deferAsync

public abstract CompletableFuture deferAsync(UUID lockToken, Map propertiesToModify)

Asynchronously defers a Message using its lock token with modified message propert. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.

Returns:

a CompletableFuture representing the pending defer.

deferAsync

public abstract CompletableFuture deferAsync(UUID lockToken, Map propertiesToModify, TransactionContext transaction)

Asynchronously defers a Message using its lock token with modified message propert. This will move message into deferred subqueue.

Parameters:

lockToken - Message lock token getLockToken()
propertiesToModify - Message properties to modify.
transaction - TransactionContext which this operation should enlist to.

Returns:

a CompletableFuture representing the pending defer.

getPrefetchCount

public abstract int getPrefetchCount()

Get the prefetch value set.

Returns:

The set prefetch count value.

getReceiveMode

public abstract ReceiveMode getReceiveMode()

Get current receiver's ReceiveMode.

Returns:

receive

public abstract IMessage receive()

Receives a Message with default server wait time.

Returns:

The received Message or null if there is no message.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receive

public abstract IMessage receive(Duration serverWaitTime)

Receives a Message with specified server wait time.

Parameters:

serverWaitTime - The server wait time

Returns:

The received Message or null if there is no message.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receiveAsync

public abstract CompletableFuture receiveAsync()

Receives a Message from Azure Service Bus.

Returns:

The message received. Returns null if no message is found

receiveAsync

public abstract CompletableFuture receiveAsync(Duration serverWaitTime)

Receives a Message from Azure Service Bus with server wait time.

Parameters:

serverWaitTime - The time the client waits for receiving a message before it times out.

Returns:

The message received. Returns null if no message is found

receiveBatch

public abstract Collection receiveBatch(int maxMessageCount)

Receives a maximum of maxMessageCount Message from Azure Service Bus.

Parameters:

maxMessageCount - The maximum number of messages that will be received.

Returns:

List of messages received. Returns null if no message is found.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receiveBatch

public abstract Collection receiveBatch(int maxMessageCount, Duration serverWaitTime)

Receives a maximum of maxMessageCount Message from Azure Service Bus with server wait time.

Parameters:

maxMessageCount - The maximum number of messages that will be received.
serverWaitTime - The time the client waits for receiving a message before it times out.

Returns:

List of messages received. Returns null if no message is found.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receiveBatchAsync

public abstract CompletableFuture<>> receiveBatchAsync(int maxMessageCount)

Asynchronously receives a maximum of maxMessageCount Message from the entity.

Parameters:

maxMessageCount - The maximum number of messages that will be received.

Returns:

a CompletableFuture representing the pending receive.

receiveBatchAsync

public abstract CompletableFuture<>> receiveBatchAsync(int maxMessageCount, Duration serverWaitTime)

Asynchronously receives a maximum of maxMessageCount Message from Azure Service Bus with server wait time.

Parameters:

maxMessageCount - The maximum number of messages that will be received.
serverWaitTime - The time the client waits for receiving a message before it times out.

Returns:

a CompletableFuture representing the pending receive.

receiveDeferredMessage

public abstract IMessage receiveDeferredMessage(long sequenceNumber)

Receives a deferred Message. Deferred messages can only be received by using sequence number.

Parameters:

sequenceNumber - The getSequenceNumber().

Returns:

The received Message or null if there is no message for given sequence number.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receiveDeferredMessageAsync

public abstract CompletableFuture receiveDeferredMessageAsync(long sequenceNumber)

Asynchronously receives a specific deferred Message identified by sequence number.

Parameters:

sequenceNumber - The sequence number of the message that will be received.

Returns:

a CompletableFuture representing the pending receive.

receiveDeferredMessageBatch

public abstract Collection receiveDeferredMessageBatch(Collection sequenceNumbers)

Receives a batch of deferred Message.

Parameters:

sequenceNumbers - The sequence numbers of desired deferred messages.

Returns:

List of messages received. Returns null if no message is found.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

receiveDeferredMessageBatchAsync

public abstract CompletableFuture<>> receiveDeferredMessageBatchAsync(Collection sequenceNumbers)

Asynchronously receives a set of deferred Message from the entity.

Parameters:

sequenceNumbers - The sequence numbers of the message that will be received.

Returns:

a CompletableFuture representing the pending receive.

renewMessageLock

public abstract Instant renewMessageLock(IMessage message)

Renews the lock on the message specified by the lock token. The lock will be renewed based on the setting specified on the entity. When a message is received in PEEKLOCK mode, the message is locked on the server for this receiver instance for a duration as specified during the Queue/Subscription creation (LockDuration). If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is reset to the entity's LockDuration value.

Parameters:

message - The Message to be renewed

Returns:

The new locked until UTC time.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

renewMessageLock

public abstract Instant renewMessageLock(UUID lockToken)

Renews the lock on the message specified by the lock token. The lock will be renewed based on the setting specified on the entity. When a message is received in PEEKLOCK mode, the message is locked on the server for this receiver instance for a duration as specified during the Queue/Subscription creation (LockDuration). If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is reset to the entity's LockDuration value. Note - calling this will not update getLockedUntilUtc() and updated lockedUntilUtc must be tracked by the application.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

The new locked until UTC time.

Throws:

InterruptedException

- if the current thread was interrupted while waiting
ServiceBusException - if the current thread was interrupted while waiting

renewMessageLockAsync

public abstract CompletableFuture renewMessageLockAsync(IMessage message)

Asynchronously renews the lock on the message specified by the lock token. The lock will be renewed based on the setting specified on the entity. When a message is received in PEEKLOCK mode, the message is locked on the server for this receiver instance for a duration as specified during the Queue/Subscription creation (LockDuration). If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is reset to the entity's LockDuration value.

Parameters:

message - The Message to be renewed

Returns:

a CompletableFuture representing the pending renew.

renewMessageLockAsync

public abstract CompletableFuture renewMessageLockAsync(UUID lockToken)

Renews the lock on the message specified by the lock token. The lock will be renewed based on the setting specified on the entity. When a message is received in PEEKLOCK mode, the message is locked on the server for this receiver instance for a duration as specified during the Queue/Subscription creation (LockDuration). If processing of the message requires longer than this duration, the lock needs to be renewed. For each renewal, the lock is reset to the entity's LockDuration value. Note - calling this will not update getLockedUntilUtc() and updated lockedUntilUtc must be tracked by the application.

Parameters:

lockToken - Message lock token getLockToken()

Returns:

a CompletableFuture representing the pending renew.

setPrefetchCount

public abstract void setPrefetchCount(int prefetchCount)

Set the prefetch count of the receiver. Prefetch speeds up the message flow by aiming to have a message readily available for local retrieval when and before the application asks for one using Receive. Setting a non-zero value prefetches PrefetchCount number of messages. Setting the value to zero turns prefetch off. For both PEEKLOCK mode and RECEIVEANDDELETE mode, the default value is 0.

The value cannot be set until the receiver is created.

Parameters:

prefetchCount - The desired prefetch count.

Throws:

ServiceBusException - if sets the value failed

Applies to