public class MessageSession extends ClientEntity implements IMessageSession
Modifier and Type | Method and Description |
---|---|
void |
abandon(UUID lockToken)
Abandon
Message with lock token. |
void |
abandon(UUID lockToken,
Map<String,Object> propertiesToModify)
Abandon
Message with lock token and updated message property. |
void |
abandon(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Abandon
Message with lock token and updated message property. |
void |
abandon(UUID lockToken,
TransactionContext transaction)
Abandon
Message with lock token. |
CompletableFuture<Void> |
abandonAsync(UUID lockToken)
Asynchronously abandon
Message with lock token. |
CompletableFuture<Void> |
abandonAsync(UUID lockToken,
Map<String,Object> propertiesToModify)
Asynchronously abandon
Message with lock token and updated message property. |
CompletableFuture<Void> |
abandonAsync(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Asynchronously abandon
Message with lock token and updated message property. |
CompletableFuture<Void> |
abandonAsync(UUID lockToken,
TransactionContext transaction)
Asynchronously abandon
Message with lock token. |
void |
complete(UUID lockToken)
Completes a
Message using its lock token. |
void |
complete(UUID lockToken,
TransactionContext transaction)
Completes a
Message using its lock token. |
CompletableFuture<Void> |
completeAsync(UUID lockToken)
Asynchronously completes a
Message using its lock token. |
CompletableFuture<Void> |
completeAsync(UUID lockToken,
TransactionContext transaction)
Asynchronously completes a
Message using its lock token. |
void |
deadLetter(UUID lockToken)
Moves a
Message to the deadletter sub-queue. |
void |
deadLetter(UUID lockToken,
Map<String,Object> propertiesToModify)
Moves a
Message to the deadletter sub-queue with modified message properties. |
void |
deadLetter(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Moves a
Message to the deadletter sub-queue with modified message properties. |
void |
deadLetter(UUID lockToken,
String deadLetterReason,
String deadLetterErrorDescription)
Moves a
Message to the deadletter sub-queue with deadletter reason and error description. |
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. |
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. |
void |
deadLetter(UUID lockToken,
String deadLetterReason,
String deadLetterErrorDescription,
TransactionContext transaction)
Moves a
Message to the deadletter sub-queue with deadletter reason and error description. |
void |
deadLetter(UUID lockToken,
TransactionContext transaction)
Moves a
Message to the deadletter sub-queue. |
CompletableFuture<Void> |
deadLetterAsync(UUID lockToken)
Asynchronously moves a
Message to the deadletter sub-queue with deadletter. |
CompletableFuture<Void> |
deadLetterAsync(UUID lockToken,
Map<String,Object> propertiesToModify)
Asynchronously moves a
Message to the deadletter sub-queue with modified properties. |
CompletableFuture<Void> |
deadLetterAsync(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Asynchronously moves a
Message to the deadletter sub-queue with modified properties. |
CompletableFuture<Void> |
deadLetterAsync(UUID lockToken,
String deadLetterReason,
String deadLetterErrorDescription)
Asynchronously moves a
Message to 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 a
Message to 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 a
Message to the deadletter sub-queue with deadletter reason and error description and modified properties. |
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. |
CompletableFuture<Void> |
deadLetterAsync(UUID lockToken,
TransactionContext transaction)
Asynchronously moves a
Message to the deadletter sub-queue with deadletter. |
void |
defer(UUID lockToken)
Defers a
Message using its lock token. |
void |
defer(UUID lockToken,
Map<String,Object> propertiesToModify)
Defers a
Message using its lock token with modified message property. |
void |
defer(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Defers a
Message using its lock token with modified message property. |
void |
defer(UUID lockToken,
TransactionContext transaction)
Defers a
Message using its lock token. |
CompletableFuture<Void> |
deferAsync(UUID lockToken)
Asynchronously defers a
Message using its lock token. |
CompletableFuture<Void> |
deferAsync(UUID lockToken,
Map<String,Object> propertiesToModify)
Asynchronously defers a
Message using its lock token with modified message propert. |
CompletableFuture<Void> |
deferAsync(UUID lockToken,
Map<String,Object> propertiesToModify,
TransactionContext transaction)
Asynchronously defers a
Message using its lock token with modified message propert. |
CompletableFuture<Void> |
deferAsync(UUID lockToken,
TransactionContext transaction)
Asynchronously defers a
Message using its lock token. |
String |
getEntityPath()
Gets the path of the entity this client is sending messages to or receiving messages from.
|
protected CoreMessageReceiver |
getInternalReceiver() |
Instant |
getLockedUntilUtc() |
int |
getPrefetchCount()
Get the prefetch value set.
|
ReceiveMode |
getReceiveMode()
Get current receiver's
ReceiveMode . |
protected String |
getRequestedSessionId() |
String |
getSessionId() |
byte[] |
getState()
Gets the session state.
|
CompletableFuture<byte[]> |
getStateAsync()
Asynchronously gets the session state.
|
protected boolean |
isBrowsableSession() |
protected boolean |
isSessionReceiver() |
protected CompletableFuture<Void> |
onClose() |
IMessage |
peek()
reads next the active message without changing the state of the receiver or the message source.
|
IMessage |
peek(long fromSequenceNumber)
Reads next the active message without changing the state of the receiver or the message source.
|
CompletableFuture<IMessage> |
peekAsync()
Asynchronously reads the active messages without changing the state of the receiver or the message source.
|
CompletableFuture<IMessage> |
peekAsync(long fromSequenceNumber)
Asynchronously reads next the active message without changing the state of the receiver or the message source.
|
Collection<IMessage> |
peekBatch(int messageCount)
Reads next batch of the active messages without changing the state of the receiver or the message source.
|
Collection<IMessage> |
peekBatch(long fromSequenceNumber,
int messageCount)
Reads next batch of the active messages without changing the state of the receiver or the message source.
|
CompletableFuture<Collection<IMessage>> |
peekBatchAsync(int messageCount)
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source.
|
CompletableFuture<Collection<IMessage>> |
peekBatchAsync(long fromSequenceNumber,
int messageCount)
Asynchronously reads the next batch of active messages without changing the state of the receiver or the message source.
|
IMessage |
receive()
Receives a
Message with default server wait time. |
IMessage |
receive(Duration serverWaitTime)
Receives a
Message with specified server wait time. |
CompletableFuture<IMessage> |
receiveAsync()
Receives a
Message from Azure Service Bus. |
CompletableFuture<IMessage> |
receiveAsync(Duration serverWaitTime)
Receives a
Message from Azure Service Bus with server wait time. |
Collection<IMessage> |
receiveBatch(int maxMessageCount)
Receives a maximum of maxMessageCount
Message from Azure Service Bus. |
Collection<IMessage> |
receiveBatch(int maxMessageCount,
Duration serverWaitTime)
Receives a maximum of maxMessageCount
Message from Azure Service Bus with server wait time. |
CompletableFuture<Collection<IMessage>> |
receiveBatchAsync(int maxMessageCount)
Asynchronously receives a maximum of maxMessageCount
Message from the entity. |
CompletableFuture<Collection<IMessage>> |
receiveBatchAsync(int maxMessageCount,
Duration serverWaitTime)
Asynchronously receives a maximum of maxMessageCount
Message from Azure Service Bus with server wait time. |
IMessage |
receiveDeferredMessage(long sequenceNumber)
Receives a deferred
Message . |
CompletableFuture<IMessage> |
receiveDeferredMessageAsync(long sequenceNumber)
Asynchronously receives a specific deferred
Message identified by sequence number. |
Collection<IMessage> |
receiveDeferredMessageBatch(Collection<Long> sequenceNumbers)
Receives a batch of deferred
Message . |
CompletableFuture<Collection<IMessage>> |
receiveDeferredMessageBatchAsync(Collection<Long> sequenceNumbers)
Asynchronously receives a set of deferred
Message from the entity. |
Instant |
renewMessageLock(IMessage message)
Renews the lock on the message specified by the lock token.
|
Instant |
renewMessageLock(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.
|
Collection<Instant> |
renewMessageLockBatch(Collection<? extends IMessage> messages) |
CompletableFuture<Collection<Instant>> |
renewMessageLockBatchAsync(Collection<? extends IMessage> messages) |
void |
renewSessionLock()
Renews the lock on the session specified by the
IMessageSession.getSessionId() . |
CompletableFuture<Void> |
renewSessionLockAsync()
Renews the lock on the session specified by the
IMessageSession.getSessionId() . |
void |
setPrefetchCount(int prefetchCount)
Set the prefetch count of the receiver.
|
void |
setState(byte[] sessionState)
Set a custom state on the session which can be later retrieved using
IMessageSession.getState() . |
CompletableFuture<Void> |
setStateAsync(byte[] sessionState)
Asynchronously set a custom state on the session which can be later retrieved using
IMessageSession.getState() . |
close, closeAsync, finalize, getClientId, getIsClosed, getIsClosingOrClosed, setClosed, setClosing, throwIfClosed
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
abandon, abandon, abandon, abandon, abandonAsync, abandonAsync, abandonAsync, abandonAsync, complete, complete, completeAsync, completeAsync, deadLetter, deadLetter, deadLetter, deadLetter, deadLetter, deadLetter, deadLetter, deadLetter, deadLetterAsync, deadLetterAsync, deadLetterAsync, deadLetterAsync, deadLetterAsync, deadLetterAsync, deadLetterAsync, deadLetterAsync, defer, defer, defer, defer, deferAsync, deferAsync, deferAsync, deferAsync, getPrefetchCount, getReceiveMode, receive, receive, receiveAsync, receiveAsync, receiveBatch, receiveBatch, receiveBatchAsync, receiveBatchAsync, receiveDeferredMessage, receiveDeferredMessageAsync, receiveDeferredMessageBatch, receiveDeferredMessageBatchAsync, renewMessageLock, renewMessageLock, renewMessageLockAsync, renewMessageLockAsync, setPrefetchCount
getEntityPath
close, closeAsync
peek, peek, peekAsync, peekAsync, peekBatch, peekBatch, peekBatchAsync, peekBatchAsync
protected final boolean isSessionReceiver()
protected boolean isBrowsableSession()
protected String getRequestedSessionId()
public Instant getLockedUntilUtc()
getLockedUntilUtc
in interface IMessageSession
IMessageSession.getSessionId()
is locked until for this client.public void renewSessionLock() throws InterruptedException, ServiceBusException
IMessageSession
IMessageSession.getSessionId()
. The lock will be renewed based on the setting specified on the entity.
When you accept a session, the session is locked for this client instance by the service for a duration as specified during the Queue/Subscription creation. If processing of the session requires longer than this duration, the session-lock needs to be renewed. For each renewal, the session-lock is renewed by the entity's LockDuration.
Renewal of session renews all the messages in the session as well. Each individual message need not be renewed.
renewSessionLock
in interface IMessageSession
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if the renew failed.public CompletableFuture<Void> renewSessionLockAsync()
IMessageSession
IMessageSession.getSessionId()
. The lock will be renewed based on the setting specified on the entity.renewSessionLockAsync
in interface IMessageSession
IMessageSession.renewSessionLock()
public void setState(byte[] sessionState) throws InterruptedException, ServiceBusException
IMessageSession
IMessageSession.getState()
.setState
in interface IMessageSession
sessionState
- The session state.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if the set state failed.public CompletableFuture<Void> setStateAsync(byte[] sessionState)
IMessageSession
IMessageSession.getState()
.setStateAsync
in interface IMessageSession
sessionState
- The session state.IMessageSession.setState(byte[])
public byte[] getState() throws InterruptedException, ServiceBusException
IMessageSession
getState
in interface IMessageSession
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if get state failed.public CompletableFuture<byte[]> getStateAsync()
IMessageSession
getStateAsync
in interface IMessageSession
IMessageSession.getState()
public String getSessionId()
getSessionId
in interface IMessageSession
protected final CoreMessageReceiver getInternalReceiver()
public String getEntityPath()
IMessageEntityClient
getEntityPath
in interface IMessageEntityClient
public ReceiveMode getReceiveMode()
IMessageReceiver
ReceiveMode
.getReceiveMode
in interface IMessageReceiver
ReceiveMode
public void abandon(UUID lockToken) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the messageabandon
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic void abandon(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the messageabandon
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic void abandon(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
IMessageReceiver
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 messageabandon
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic void abandon(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
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 messageabandon
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic CompletableFuture<Void> abandonAsync(UUID lockToken)
IMessageReceiver
Message
with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.abandonAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
public CompletableFuture<Void> abandonAsync(UUID lockToken, TransactionContext transaction)
IMessageReceiver
Message
with lock token. This will make the message available again for processing. Abandoning a message will increase the delivery count on the message.abandonAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.public CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify)
IMessageReceiver
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.abandonAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.public CompletableFuture<Void> abandonAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
IMessageReceiver
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.abandonAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.public void complete(UUID lockToken) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token. This will delete the message from the service.complete
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic void complete(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token. This will delete the message from the service.complete
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if abandon failedpublic CompletableFuture<Void> completeAsync(UUID lockToken)
IMessageReceiver
Message
using its lock token. This will delete the message from the service.completeAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
public CompletableFuture<Void> completeAsync(UUID lockToken, TransactionContext transaction)
IMessageReceiver
Message
using its lock token. This will delete the message from the service.completeAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.public void defer(UUID lockToken) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token. This will move message into deferred subqueue.defer
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if defer failedpublic void defer(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token. This will move message into deferred subqueue.defer
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if defer failedpublic void defer(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token with modified message property. This will move message into deferred subqueue.defer
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if defer failedpublic void defer(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
using its lock token with modified message property. This will move message into deferred subqueue.defer
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if defer failedpublic CompletableFuture<Void> deferAsync(UUID lockToken)
IMessageReceiver
Message
using its lock token. This will move message into deferred subqueue.deferAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
public CompletableFuture<Void> deferAsync(UUID lockToken, TransactionContext transaction)
IMessageReceiver
Message
using its lock token. This will move message into deferred subqueue.deferAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.public CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify)
IMessageReceiver
Message
using its lock token with modified message propert. This will move message into deferred subqueue.deferAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.public CompletableFuture<Void> deferAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
IMessageReceiver
Message
using its lock token with modified message propert. This will move message into deferred subqueue.deferAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.public void deadLetter(UUID lockToken) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with modified message properties.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with modified message properties.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description and modified properties.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.propertiesToModify
- Message properties to modify.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic void deadLetter(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description and modified properties.deadLetter
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if deadletter failedpublic CompletableFuture<Void> deadLetterAsync(UUID lockToken)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
public CompletableFuture<Void> deadLetterAsync(UUID lockToken, TransactionContext transaction)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
transaction
- TransactionContext
which this operation should enlist to.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify)
IMessageReceiver
Message
to the deadletter sub-queue with modified properties.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, Map<String,Object> propertiesToModify, TransactionContext transaction)
IMessageReceiver
Message
to the deadletter sub-queue with modified properties.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, TransactionContext transaction)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.transaction
- TransactionContext
which this operation should enlist to.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description and modified properties.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.propertiesToModify
- Message properties to modify.public CompletableFuture<Void> deadLetterAsync(UUID lockToken, String deadLetterReason, String deadLetterErrorDescription, Map<String,Object> propertiesToModify, TransactionContext transaction)
IMessageReceiver
Message
to the deadletter sub-queue with deadletter reason and error description and modified properties.deadLetterAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
deadLetterReason
- The deadletter reason.deadLetterErrorDescription
- The deadletter error description.propertiesToModify
- Message properties to modify.transaction
- TransactionContext
which this operation should enlist to.public IMessage receive() throws InterruptedException, ServiceBusException
IMessageReceiver
Message
with default server wait time.receive
in interface IMessageReceiver
Message
or null if there is no message.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if receive failedpublic IMessage receive(Duration serverWaitTime) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
with specified server wait time.receive
in interface IMessageReceiver
serverWaitTime
- The server wait timeMessage
or null if there is no message.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if receive failedpublic IMessage receiveDeferredMessage(long sequenceNumber) throws ServiceBusException, InterruptedException
IMessageReceiver
Message
. Deferred messages can only be received by using sequence number.receiveDeferredMessage
in interface IMessageReceiver
sequenceNumber
- The Message.getSequenceNumber()
.Message
or null if there is no message for given sequence number.ServiceBusException
- if receive failedInterruptedException
- if the current thread was interrupted while waitingpublic Collection<IMessage> receiveBatch(int maxMessageCount) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
from Azure Service Bus.receiveBatch
in interface IMessageReceiver
maxMessageCount
- The maximum number of messages that will be received.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if receive failedpublic Collection<IMessage> receiveBatch(int maxMessageCount, Duration serverWaitTime) throws InterruptedException, ServiceBusException
IMessageReceiver
Message
from Azure Service Bus with server wait time.receiveBatch
in interface IMessageReceiver
maxMessageCount
- The maximum number of messages that will be received.serverWaitTime
- The time the client waits for receiving a message before it times out.InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if receive failedpublic Collection<IMessage> receiveDeferredMessageBatch(Collection<Long> sequenceNumbers) throws ServiceBusException, InterruptedException
IMessageReceiver
Message
.receiveDeferredMessageBatch
in interface IMessageReceiver
sequenceNumbers
- The sequence numbers of desired deferred messages.ServiceBusException
- if receive failedInterruptedException
- if the current thread was interrupted while waitingpublic CompletableFuture<IMessage> receiveAsync()
IMessageReceiver
Message
from Azure Service Bus.receiveAsync
in interface IMessageReceiver
public CompletableFuture<IMessage> receiveAsync(Duration serverWaitTime)
IMessageReceiver
Message
from Azure Service Bus with server wait time.receiveAsync
in interface IMessageReceiver
serverWaitTime
- The time the client waits for receiving a message before it times out.public CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount)
IMessageReceiver
Message
from the entity.receiveBatchAsync
in interface IMessageReceiver
maxMessageCount
- The maximum number of messages that will be received.public CompletableFuture<Collection<IMessage>> receiveBatchAsync(int maxMessageCount, Duration serverWaitTime)
IMessageReceiver
Message
from Azure Service Bus with server wait time.receiveBatchAsync
in interface IMessageReceiver
maxMessageCount
- The maximum number of messages that will be received.serverWaitTime
- The time the client waits for receiving a message before it times out.public CompletableFuture<IMessage> receiveDeferredMessageAsync(long sequenceNumber)
IMessageReceiver
Message
identified by sequence number.receiveDeferredMessageAsync
in interface IMessageReceiver
sequenceNumber
- The sequence number of the message that will be received.public CompletableFuture<Collection<IMessage>> receiveDeferredMessageBatchAsync(Collection<Long> sequenceNumbers)
IMessageReceiver
Message
from the entity.receiveDeferredMessageBatchAsync
in interface IMessageReceiver
sequenceNumbers
- The sequence numbers of the message that will be received.protected CompletableFuture<Void> onClose()
onClose
in class ClientEntity
public int getPrefetchCount()
IMessageReceiver
getPrefetchCount
in interface IMessageReceiver
public void setPrefetchCount(int prefetchCount) throws ServiceBusException
IMessageReceiver
The value cannot be set until the receiver is created.
setPrefetchCount
in interface IMessageReceiver
prefetchCount
- The desired prefetch count.ServiceBusException
- if sets the value failedpublic CompletableFuture<Instant> renewMessageLockAsync(IMessage message)
IMessageReceiver
ReceiveMode.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.renewMessageLockAsync
in interface IMessageReceiver
message
- The Message
to be renewedpublic CompletableFuture<Instant> renewMessageLockAsync(UUID lockToken)
IMessageReceiver
ReceiveMode.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 Message.getLockedUntilUtc()
and updated lockedUntilUtc must be tracked by the application.renewMessageLockAsync
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
public CompletableFuture<Collection<Instant>> renewMessageLockBatchAsync(Collection<? extends IMessage> messages)
public Collection<Instant> renewMessageLockBatch(Collection<? extends IMessage> messages) throws InterruptedException, ServiceBusException
public Instant renewMessageLock(IMessage message) throws InterruptedException, ServiceBusException
IMessageReceiver
ReceiveMode.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.renewMessageLock
in interface IMessageReceiver
message
- The Message
to be renewedInterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if renew failedpublic Instant renewMessageLock(UUID lockToken) throws InterruptedException, ServiceBusException
IMessageReceiver
ReceiveMode.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 Message.getLockedUntilUtc()
and updated lockedUntilUtc must be tracked by the application.renewMessageLock
in interface IMessageReceiver
lockToken
- Message lock token Message.getLockToken()
InterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if renew failedpublic IMessage peek() throws InterruptedException, ServiceBusException
IMessageBrowser
IMessageBrowser.peek()
fetches the first active message for this receiver.
Each subsequent call fetches the subsequent message in the entity.peek
in interface IMessageBrowser
Message
peekedInterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if peek failedpublic IMessage peek(long fromSequenceNumber) throws InterruptedException, ServiceBusException
IMessageBrowser
peek
in interface IMessageBrowser
fromSequenceNumber
- The sequence number from where to read the message.Message
peekedInterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if peek failedpublic Collection<IMessage> peekBatch(int messageCount) throws InterruptedException, ServiceBusException
IMessageBrowser
peekBatch
in interface IMessageBrowser
messageCount
- The number of messages.Message
peekedInterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if peek failedpublic Collection<IMessage> peekBatch(long fromSequenceNumber, int messageCount) throws InterruptedException, ServiceBusException
IMessageBrowser
peekBatch
in interface IMessageBrowser
fromSequenceNumber
- The sequence number from where to read the message.messageCount
- The number of messages.Message
peekedInterruptedException
- if the current thread was interrupted while waitingServiceBusException
- if peek failedpublic CompletableFuture<IMessage> peekAsync()
IMessageBrowser
peekAsync
in interface IMessageBrowser
Message
peekedpublic CompletableFuture<IMessage> peekAsync(long fromSequenceNumber)
IMessageBrowser
peekAsync
in interface IMessageBrowser
fromSequenceNumber
- The sequence number from where to read the message.Message
peeked.public CompletableFuture<Collection<IMessage>> peekBatchAsync(int messageCount)
IMessageBrowser
peekBatchAsync
in interface IMessageBrowser
messageCount
- The number of messages.Message
peeked.public CompletableFuture<Collection<IMessage>> peekBatchAsync(long fromSequenceNumber, int messageCount)
IMessageBrowser
peekBatchAsync
in interface IMessageBrowser
fromSequenceNumber
- The sequence number from where to read the message.messageCount
- The number of messages.Message
peeked.Copyright © 2019 Microsoft Corporation. All rights reserved.