public class InMemoryMessageContext extends Object implements MessageContext
| Constructor and Description |
|---|
InMemoryMessageContext(String payload) |
| Modifier and Type | Method and Description |
|---|---|
void |
acknowledge()
Called by a message consumer to acknowledge the receipt of a message and prevent it's redelivery to another consumer.
|
Optional<String> |
getMessageId() |
Optional<String> |
getPayload() |
boolean |
isCancellationRequested()
Returns
true if the MessageRunner should terminate its activities as gracefully as possible
and exit; false to continue running normally. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcancelAutoAcknowledgementOfMessage, shouldAutoAcknowledgeMessagepublic Optional<String> getMessageId()
getMessageId in interface MessageContextpublic Optional<String> getPayload()
getPayload in interface MessageContextpublic void acknowledge()
MessageContextPlease note: due to the distributed nature of how messages are stored in some implementations, there are no guarantees that the message won't be redelivered to another consumer (even after this method is called). However, redelivery after acknowledge() is rare.
This method is thread-safe and idempotent.
acknowledge in interface MessageContextpublic boolean isCancellationRequested()
MessageContexttrue if the MessageRunner should terminate its activities as gracefully as possible
and exit; false to continue running normally.
MessageRunner cancellation is entirely cooperative. If a MessageRunner is likely to take longer
than a few seconds to complete its work, then it should periodically check this value and react to it. Normally,
cancellation is requested because the application is trying to shut down, and continuing to run
after this flag has been set increases the chance that the system administrator will grow
impatient and forcibly kill the application.
isCancellationRequested in interface MessageContexttrue if cancellation is requested; false otherwiseCopyright © 2017 Atlassian. All rights reserved.