Class QueueMessage
- java.lang.Object
-
- dk.cloudcreate.essentials.components.foundation.messaging.queue.operations.QueueMessage
-
public class QueueMessage extends Object
Queue a message for asynchronous delivery optional delay to aDurableQueueConsumer
Note this method MUST be called within an existingUnitOfWorkIF usingTransactionalMode.FullyTransactional
Operation also matchesDurableQueuesInterceptor.intercept(QueueMessage, InterceptorChain)
-
-
Constructor Summary
Constructors Constructor Description QueueMessage(QueueName queueName, Message message, Exception causeOfEnqueuing, Duration deliveryDelay)Queue a message for asynchronous delivery optional delay to aDurableQueueConsumer
Note this method MUST be called within an existingUnitOfWorkIF usingTransactionalMode.FullyTransactionalQueueMessage(QueueName queueName, Message message, Optional<Exception> causeOfEnqueuing, Optional<Duration> deliveryDelay)Queue a message for asynchronous delivery optional delay to aDurableQueueConsumer
Note this method MUST be called within an existingUnitOfWorkIF usingTransactionalMode.FullyTransactional
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static QueueMessageBuilderbuilder()Create a new builder that produces a newQueueMessageinstanceOptional<Exception>getCauseOfEnqueuing()Optional<Duration>getDeliveryDelay()MessagegetMessage()Get the message being queuedMessageMetaDatagetMetaData()ObjectgetPayload()QueueNamegetQueueName()voidsetCauseOfEnqueuing(Exception causeOfEnqueuing)voidsetCauseOfEnqueuing(Optional<Exception> causeOfEnqueuing)voidsetDeliveryDelay(Duration deliveryDelay)voidsetDeliveryDelay(Optional<Duration> deliveryDelay)voidsetMessage(Message message)StringtoString()
-
-
-
Field Detail
-
queueName
public final QueueName queueName
-
-
Constructor Detail
-
QueueMessage
public QueueMessage(QueueName queueName, Message message, Optional<Exception> causeOfEnqueuing, Optional<Duration> deliveryDelay)
Queue a message for asynchronous delivery optional delay to aDurableQueueConsumer
Note this method MUST be called within an existingUnitOfWorkIF usingTransactionalMode.FullyTransactional- Parameters:
queueName- the name of the Queue the message is added tomessage- the message being queued (Message/OrderedMessage)causeOfEnqueuing- the optional reason for the message being queueddeliveryDelay- the Optional delay for the first delivery of the message to theDurableQueueConsumer- See Also:
OrderedMessage
-
QueueMessage
public QueueMessage(QueueName queueName, Message message, Exception causeOfEnqueuing, Duration deliveryDelay)
Queue a message for asynchronous delivery optional delay to aDurableQueueConsumer
Note this method MUST be called within an existingUnitOfWorkIF usingTransactionalMode.FullyTransactional- Parameters:
queueName- the name of the Queue the message is added tomessage- the message being queued (Message/OrderedMessage)causeOfEnqueuing- the optional reason for the message being queueddeliveryDelay- the Optional delay for the first delivery of the message to theDurableQueueConsumer- See Also:
OrderedMessage
-
-
Method Detail
-
builder
public static QueueMessageBuilder builder()
Create a new builder that produces a newQueueMessageinstance- Returns:
- a new
QueueMessageBuilderinstance
-
getQueueName
public QueueName getQueueName()
- Returns:
- the name of the Queue the message is added to
-
getPayload
public Object getPayload()
- Returns:
- the message payload
-
getCauseOfEnqueuing
public Optional<Exception> getCauseOfEnqueuing()
- Returns:
- the optional reason for the message being queued
-
getDeliveryDelay
public Optional<Duration> getDeliveryDelay()
- Returns:
- the Optional delay for the first delivery of the message to the
DurableQueueConsumer
-
setMessage
public void setMessage(Message message)
- Parameters:
message- the message being queued (Message/OrderedMessage)
-
getMessage
public Message getMessage()
Get the message being queued- Returns:
- Get the message being queued (
Message/OrderedMessage)
-
setDeliveryDelay
public void setDeliveryDelay(Optional<Duration> deliveryDelay)
- Parameters:
deliveryDelay- the Optional delay for the first delivery of the message to theDurableQueueConsumer
-
getMetaData
public MessageMetaData getMetaData()
- Returns:
- metadata metadata related to the message/payload
-
setCauseOfEnqueuing
public void setCauseOfEnqueuing(Optional<Exception> causeOfEnqueuing)
- Parameters:
causeOfEnqueuing- the optional reason for the message being queued
-
setDeliveryDelay
public void setDeliveryDelay(Duration deliveryDelay)
- Parameters:
deliveryDelay- the Optional delay for the first delivery of the message to theDurableQueueConsumer
-
setCauseOfEnqueuing
public void setCauseOfEnqueuing(Exception causeOfEnqueuing)
- Parameters:
causeOfEnqueuing- the optional reason for the message being queued
-
-