Package com.microsoft.azure.servicebus
Interface IMessageReceiver
-
- All Superinterfaces:
ICloseable,IMessageBrowser,IMessageEntityClient
- All Known Subinterfaces:
IMessageSession
- All Known Implementing Classes:
MessageSession
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
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidabandon(UUID lockToken)AbandonMessagewith lock token.voidabandon(UUID lockToken, TransactionContext transaction)AbandonMessagewith lock token.voidabandon(UUID lockToken, Map<String,Object> propertiesToModify)AbandonMessagewith lock token and updated message property.voidabandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)AbandonMessagewith lock token and updated message property.CompletableFuture<Void>abandonAsync(UUID lockToken)Asynchronously abandonMessagewith lock token.CompletableFuture<Void>abandonAsync(UUID lockToken, TransactionContext transaction)Asynchronously abandonMessagewith lock token.CompletableFuture<Void>abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)Asynchronously abandonMessagewith lock token and updated message property.CompletableFuture<Void>abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)Asynchronously abandonMessagewith lock token and updated message property.voidcomplete(UUID lockToken)Completes aMessageusing its lock token.voidcomplete(UUID lockToken, TransactionContext transaction)Completes aMessageusing its lock token.CompletableFuture<Void>completeAsync(UUID lockToken)Asynchronously completes aMessageusing its lock token.CompletableFuture<Void>completeAsync(UUID lockToken, TransactionContext transaction)Asynchronously completes aMessageusing its lock token.voiddeadLetter(UUID lockToken)Moves aMessageto the deadletter sub-queue.voiddeadLetter(UUID lockToken, TransactionContext transaction)Moves aMessageto the deadletter sub-queue.voiddeadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)Moves aMessageto the deadletter sub-queue with deadletter reason and error description.voiddeadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)Moves aMessageto the deadletter sub-queue with deadletter reason and error description.voiddeadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)Moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.voiddeadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)Moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.voiddeadLetter(UUID lockToken, Map<String,Object> propertiesToModify)Moves aMessageto the deadletter sub-queue with modified message properties.voiddeadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)Moves aMessageto the deadletter sub-queue with modified message properties.CompletableFuture<Void>deadLetterAsync(UUID lockToken)Asynchronously moves aMessageto the deadletter sub-queue with deadletter.CompletableFuture<Void>deadLetterAsync(UUID lockToken, TransactionContext transaction)Asynchronously moves aMessageto the deadletter sub-queue with deadletter.CompletableFuture<Void>deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description.CompletableFuture<Void>deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description.CompletableFuture<Void>deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.CompletableFuture<Void>deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.CompletableFuture<Void>deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify)Asynchronously moves aMessageto the deadletter sub-queue with modified properties.CompletableFuture<Void>deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)Asynchronously moves aMessageto the deadletter sub-queue with modified properties.voiddefer(UUID lockToken)Defers aMessageusing its lock token.voiddefer(UUID lockToken, TransactionContext transaction)Defers aMessageusing its lock token.voiddefer(UUID lockToken, Map<String,Object> propertiesToModify)Defers aMessageusing its lock token with modified message property.voiddefer(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)Defers aMessageusing its lock token with modified message property.CompletableFuture<Void>deferAsync(UUID lockToken)Asynchronously defers aMessageusing its lock token.CompletableFuture<Void>deferAsync(UUID lockToken, TransactionContext transaction)Asynchronously defers aMessageusing its lock token.CompletableFuture<Void>deferAsync(UUID lockToken, Map<String,Object> propertiesToModify)Asynchronously defers aMessageusing its lock token with modified message propert.CompletableFuture<Void>deferAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)Asynchronously defers aMessageusing its lock token with modified message propert.intgetPrefetchCount()Get the prefetch value set.ReceiveModegetReceiveMode()Get current receiver'sReceiveMode.IMessagereceive()Receives aMessagewith default server wait time.IMessagereceive(Duration serverWaitTime)Receives aMessagewith specified server wait time.CompletableFuture<IMessage>receiveAsync()Receives aMessagefrom Azure Service Bus.CompletableFuture<IMessage>receiveAsync(Duration serverWaitTime)Receives aMessagefrom Azure Service Bus with server wait time.Collection<IMessage>receiveBatch(int maxMessageCount)Receives a maximum of maxMessageCountMessagefrom Azure Service Bus.Collection<IMessage>receiveBatch(int maxMessageCount, Duration serverWaitTime)Receives a maximum of maxMessageCountMessagefrom Azure Service Bus with server wait time.CompletableFuture<Collection<IMessage>>receiveBatchAsync(int maxMessageCount)Asynchronously receives a maximum of maxMessageCountMessagefrom the entity.CompletableFuture<Collection<IMessage>>receiveBatchAsync(int maxMessageCount, Duration serverWaitTime)Asynchronously receives a maximum of maxMessageCountMessagefrom Azure Service Bus with server wait time.IMessagereceiveDeferredMessage(long sequenceNumber)Receives a deferredMessage.CompletableFuture<IMessage>receiveDeferredMessageAsync(long sequenceNumber)Asynchronously receives a specific deferredMessageidentified by sequence number.Collection<IMessage>receiveDeferredMessageBatch(Collection<Long> sequenceNumbers)Receives a batch of deferredMessage.CompletableFuture<Collection<IMessage>>receiveDeferredMessageBatchAsync(Collection<Long> sequenceNumbers)Asynchronously receives a set of deferredMessagefrom the entity.InstantrenewMessageLock(IMessage message)Renews the lock on the message specified by the lock token.InstantrenewMessageLock(UUID lockToken)Renews the lock on the message specified by the lock token.CompletableFuture<Instant>renewMessageLockAsync(IMessage message)Asynchronously renews the lock on the message specified by the lock token.CompletableFuture<Instant>renewMessageLockAsync(UUID lockToken)Renews the lock on the message specified by the lock token.voidsetPrefetchCount(int prefetchCount)Set the prefetch count of the receiver.-
Methods inherited from interface com.microsoft.azure.servicebus.ICloseable
close, closeAsync
-
Methods inherited from interface com.microsoft.azure.servicebus.IMessageBrowser
peek, peek, peekAsync, peekAsync, peekBatch, peekBatch, peekBatchAsync, peekBatchAsync
-
Methods inherited from interface com.microsoft.azure.servicebus.IMessageEntityClient
getEntityPath
-
-
-
-
Method Detail
-
getReceiveMode
ReceiveMode getReceiveMode()
Get current receiver'sReceiveMode.- Returns:
ReceiveMode
-
abandon
void abandon(UUID lockToken) throws InterruptedException, ServiceBusException
AbandonMessagewith 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 tokenMessage.getLockToken()- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
abandon
void abandon(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
AbandonMessagewith 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 tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
abandon
void abandon(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
AbandonMessagewith 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 tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
abandon
void abandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
AbandonMessagewith 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 tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
abandonAsync
CompletableFuture<Void> abandonAsync(UUID lockToken)
Asynchronously abandonMessagewith 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 tokenMessage.getLockToken()- Returns:
- a CompletableFuture representing the pending abandon.
-
abandonAsync
CompletableFuture<Void> abandonAsync(UUID lockToken, TransactionContext transaction)
Asynchronously abandonMessagewith 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 tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending abandon.
-
abandonAsync
CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)
Asynchronously abandonMessagewith 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 tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Returns:
- a CompletableFuture representing the pending abandon.
-
abandonAsync
CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
Asynchronously abandonMessagewith 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 tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending abandon.
-
complete
void complete(UUID lockToken) throws InterruptedException, ServiceBusException
Completes aMessageusing its lock token. This will delete the message from the service.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
complete
void complete(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
Completes aMessageusing its lock token. This will delete the message from the service.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if abandon failed
-
completeAsync
CompletableFuture<Void> completeAsync(UUID lockToken)
Asynchronously completes aMessageusing its lock token. This will delete the message from the service.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Returns:
- a CompletableFuture representing the pending complete.
-
completeAsync
CompletableFuture<Void> completeAsync(UUID lockToken, TransactionContext transaction)
Asynchronously completes aMessageusing its lock token. This will delete the message from the service.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending complete.
-
defer
void defer(UUID lockToken) throws InterruptedException, ServiceBusException
Defers aMessageusing its lock token. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if defer failed
-
defer
void defer(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
Defers aMessageusing its lock token. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if defer failed
-
defer
void defer(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
Defers aMessageusing its lock token with modified message property. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if defer failed
-
defer
void defer(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
Defers aMessageusing its lock token with modified message property. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if defer failed
-
deferAsync
CompletableFuture<Void> deferAsync(UUID lockToken)
Asynchronously defers aMessageusing its lock token. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Returns:
- a CompletableFuture representing the pending defer.
-
deferAsync
CompletableFuture<Void> deferAsync(UUID lockToken, TransactionContext transaction)
Asynchronously defers aMessageusing its lock token. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending defer.
-
deferAsync
CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify)
Asynchronously defers aMessageusing its lock token with modified message propert. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Returns:
- a CompletableFuture representing the pending defer.
-
deferAsync
CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
Asynchronously defers aMessageusing its lock token with modified message propert. This will move message into deferred subqueue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending defer.
-
deadLetter
void deadLetter(UUID lockToken) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with modified message properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with modified message properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with deadletter reason and error description.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with deadletter reason and error description.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.propertiesToModify- Message properties to modify.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetter
void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
Moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if deadletter failed
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, TransactionContext transaction)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify)
Asynchronously moves aMessageto the deadletter sub-queue with modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
Asynchronously moves aMessageto the deadletter sub-queue with modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.propertiesToModify- Message properties to modify.- Returns:
- a CompletableFuture representing the pending deadletter.
-
deadLetterAsync
CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)
Asynchronously moves aMessageto the deadletter sub-queue with deadletter reason and error description and modified properties.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()deadLetterReason- The deadletter reason.deadLetterErrorDescription- The deadletter error description.propertiesToModify- Message properties to modify.transaction-TransactionContextwhich this operation should enlist to.- Returns:
- a CompletableFuture representing the pending deadletter.
-
receive
IMessage receive() throws InterruptedException, ServiceBusException
Receives aMessagewith default server wait time.- Returns:
- The received
Messageor null if there is no message. - Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if receive failed
-
receive
IMessage receive(Duration serverWaitTime) throws InterruptedException, ServiceBusException
Receives aMessagewith specified server wait time.- Parameters:
serverWaitTime- The server wait time- Returns:
- The received
Messageor null if there is no message. - Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if receive failed
-
receiveDeferredMessage
IMessage receiveDeferredMessage(long sequenceNumber) throws InterruptedException, ServiceBusException
Receives a deferredMessage. Deferred messages can only be received by using sequence number.- Parameters:
sequenceNumber- TheMessage.getSequenceNumber().- Returns:
- The received
Messageor null if there is no message for given sequence number. - Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if receive failed
-
receiveBatch
Collection<IMessage> receiveBatch(int maxMessageCount) throws InterruptedException, ServiceBusException
Receives a maximum of maxMessageCountMessagefrom 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 waitingServiceBusException- if receive failed
-
receiveBatch
Collection<IMessage> receiveBatch(int maxMessageCount, Duration serverWaitTime) throws InterruptedException, ServiceBusException
Receives a maximum of maxMessageCountMessagefrom 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 waitingServiceBusException- if receive failed
-
receiveDeferredMessageBatch
Collection<IMessage> receiveDeferredMessageBatch(Collection<Long> sequenceNumbers) throws InterruptedException, ServiceBusException
Receives a batch of deferredMessage.- 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 waitingServiceBusException- if receive failed
-
receiveAsync
CompletableFuture<IMessage> receiveAsync()
Receives aMessagefrom Azure Service Bus.- Returns:
- The message received. Returns null if no message is found
-
receiveAsync
CompletableFuture<IMessage> receiveAsync(Duration serverWaitTime)
Receives aMessagefrom 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
-
receiveDeferredMessageAsync
CompletableFuture<IMessage> receiveDeferredMessageAsync(long sequenceNumber)
Asynchronously receives a specific deferredMessageidentified by sequence number.- Parameters:
sequenceNumber- The sequence number of the message that will be received.- Returns:
- a CompletableFuture representing the pending receive.
-
receiveBatchAsync
CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount)
Asynchronously receives a maximum of maxMessageCountMessagefrom the entity.- Parameters:
maxMessageCount- The maximum number of messages that will be received.- Returns:
- a CompletableFuture representing the pending receive.
-
receiveBatchAsync
CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount, Duration serverWaitTime)
Asynchronously receives a maximum of maxMessageCountMessagefrom 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.
-
receiveDeferredMessageBatchAsync
CompletableFuture<Collection<IMessage>> receiveDeferredMessageBatchAsync(Collection<Long> sequenceNumbers)
Asynchronously receives a set of deferredMessagefrom the entity.- Parameters:
sequenceNumbers- The sequence numbers of the message that will be received.- Returns:
- a CompletableFuture representing the pending receive.
-
renewMessageLockAsync
CompletableFuture<Instant> 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 inReceiveMode.PEEKLOCKmode, 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- TheMessageto be renewed- Returns:
- a CompletableFuture representing the pending renew.
-
renewMessageLockAsync
CompletableFuture<Instant> 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 inReceiveMode.PEEKLOCKmode, 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 updateMessage.getLockedUntilUtc()and updated lockedUntilUtc must be tracked by the application.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Returns:
- a CompletableFuture representing the pending renew.
-
renewMessageLock
Instant renewMessageLock(IMessage message) throws InterruptedException, ServiceBusException
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 inReceiveMode.PEEKLOCKmode, 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- TheMessageto be renewed- Returns:
- The new locked until UTC time.
- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if renew failed
-
renewMessageLock
Instant renewMessageLock(UUID lockToken) throws InterruptedException, ServiceBusException
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 inReceiveMode.PEEKLOCKmode, 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 updateMessage.getLockedUntilUtc()and updated lockedUntilUtc must be tracked by the application.- Parameters:
lockToken- Message lock tokenMessage.getLockToken()- Returns:
- The new locked until UTC time.
- Throws:
InterruptedException- if the current thread was interrupted while waitingServiceBusException- if renew failed
-
getPrefetchCount
int getPrefetchCount()
Get the prefetch value set.- Returns:
- The set prefetch count value.
-
setPrefetchCount
void setPrefetchCount(int prefetchCount) throws ServiceBusExceptionSet 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
-
-