Class DefaultQueuedMessage
- java.lang.Object
-
- dk.cloudcreate.essentials.components.foundation.messaging.queue.DefaultQueuedMessage
-
- All Implemented Interfaces:
QueuedMessage
public class DefaultQueuedMessage extends Object implements QueuedMessage
Represents a message queued onto a Durable Queue
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface dk.cloudcreate.essentials.components.foundation.messaging.queue.QueuedMessage
QueuedMessage.DeliveryMode
-
-
Field Summary
Fields Modifier and Type Field Description OffsetDateTimeaddedTimestampQueueEntryIdidbooleanisDeadLetterMessageStringlastDeliveryErrorMessagemessageThe deserialized message payloadOffsetDateTimenextDeliveryTimestampQueueNamequeueNameintredeliveryAttemptsinttotalDeliveryAttempts
-
Constructor Summary
Constructors Constructor Description DefaultQueuedMessage(QueueEntryId id, QueueName queueName, Message message, OffsetDateTime addedTimestamp, OffsetDateTime nextDeliveryTimestamp, String lastDeliveryError, int totalDeliveryAttempts, int redeliveryAttempts, boolean isDeadLetterMessage)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object o)OffsetDateTimegetAddedTimestamp()When was this message first enqueued (or directly added as a Dead-letter-message)QueuedMessage.DeliveryModegetDeliveryMode()QueueEntryIdgetId()The unique queue entry id for this messageStringgetLastDeliveryError()Get the error from the last delivery (null if no error is recorded)MessagegetMessage()Get the message queuedOffsetDateTimegetNextDeliveryTimestamp()Timestamp for when the message should be delivered next time.QueueNamegetQueueName()Name of the Queue that the message is enqueued onintgetRedeliveryAttempts()How many times has we attempted to re-deliver this message (same asQueuedMessage.getTotalDeliveryAttempts()-1)intgetTotalDeliveryAttempts()Get the total number of delivery attempts for this messageinthashCode()booleanisDeadLetterMessage()Is this a poison/dead-letter message that will not be delivered untilDurableQueues.resurrectDeadLetterMessage(ResurrectDeadLetterMessage)is calledStringtoString()-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface dk.cloudcreate.essentials.components.foundation.messaging.queue.QueuedMessage
getMetaData, getPayload
-
-
-
-
Field Detail
-
id
public final QueueEntryId id
-
queueName
public final QueueName queueName
-
message
public final Message message
The deserialized message payload
-
addedTimestamp
public final OffsetDateTime addedTimestamp
-
nextDeliveryTimestamp
public final OffsetDateTime nextDeliveryTimestamp
-
lastDeliveryError
public final String lastDeliveryError
-
totalDeliveryAttempts
public final int totalDeliveryAttempts
-
redeliveryAttempts
public final int redeliveryAttempts
-
isDeadLetterMessage
public final boolean isDeadLetterMessage
-
-
Constructor Detail
-
DefaultQueuedMessage
public DefaultQueuedMessage(QueueEntryId id, QueueName queueName, Message message, OffsetDateTime addedTimestamp, OffsetDateTime nextDeliveryTimestamp, String lastDeliveryError, int totalDeliveryAttempts, int redeliveryAttempts, boolean isDeadLetterMessage)
-
-
Method Detail
-
getId
public QueueEntryId getId()
Description copied from interface:QueuedMessageThe unique queue entry id for this message- Specified by:
getIdin interfaceQueuedMessage- Returns:
-
getQueueName
public QueueName getQueueName()
Description copied from interface:QueuedMessageName of the Queue that the message is enqueued on- Specified by:
getQueueNamein interfaceQueuedMessage- Returns:
- name of the Queue that the message is enqueued on
-
getMessage
public Message getMessage()
Description copied from interface:QueuedMessageGet the message queued- Specified by:
getMessagein interfaceQueuedMessage
-
getDeliveryMode
public QueuedMessage.DeliveryMode getDeliveryMode()
- Specified by:
getDeliveryModein interfaceQueuedMessage
-
getAddedTimestamp
public OffsetDateTime getAddedTimestamp()
Description copied from interface:QueuedMessageWhen was this message first enqueued (or directly added as a Dead-letter-message)- Specified by:
getAddedTimestampin interfaceQueuedMessage- Returns:
- when was this message first enqueued
-
getNextDeliveryTimestamp
public OffsetDateTime getNextDeliveryTimestamp()
Description copied from interface:QueuedMessageTimestamp for when the message should be delivered next time. Null ifQueuedMessage.isDeadLetterMessage()is true- Specified by:
getNextDeliveryTimestampin interfaceQueuedMessage- Returns:
- timestamp for when the message should be delivered next time. Null if
QueuedMessage.isDeadLetterMessage()is true
-
getLastDeliveryError
public String getLastDeliveryError()
Description copied from interface:QueuedMessageGet the error from the last delivery (null if no error is recorded)- Specified by:
getLastDeliveryErrorin interfaceQueuedMessage- Returns:
- Get the error from the last delivery (null if no error is recorded)
-
getTotalDeliveryAttempts
public int getTotalDeliveryAttempts()
Description copied from interface:QueuedMessageGet the total number of delivery attempts for this message- Specified by:
getTotalDeliveryAttemptsin interfaceQueuedMessage- Returns:
- the total number of delivery attempts for this message
-
getRedeliveryAttempts
public int getRedeliveryAttempts()
Description copied from interface:QueuedMessageHow many times has we attempted to re-deliver this message (same asQueuedMessage.getTotalDeliveryAttempts()-1)- Specified by:
getRedeliveryAttemptsin interfaceQueuedMessage- Returns:
- how many times has we attempted to re-deliver this message (same as
QueuedMessage.getTotalDeliveryAttempts()-1)
-
isDeadLetterMessage
public boolean isDeadLetterMessage()
Description copied from interface:QueuedMessageIs this a poison/dead-letter message that will not be delivered untilDurableQueues.resurrectDeadLetterMessage(ResurrectDeadLetterMessage)is called- Specified by:
isDeadLetterMessagein interfaceQueuedMessage- Returns:
- Is this a poison/dead-letter message
-
-