java.lang.Object
java.lang.Enum<TransactionalMode>
dk.cloudcreate.essentials.components.foundation.messaging.queue.TransactionalMode
All Implemented Interfaces:
Serializable, Comparable<TransactionalMode>, Constable

public enum TransactionalMode extends Enum<TransactionalMode>
The transactional behaviour mode of a DurableQueues. The recommended value is SingleOperationTransaction (see the description)

The normal message processing flow looks like this:


 durableQueues.queueMessage(queueName, message);
 var msgUnderDelivery = durableQueues.getNextMessageReadyForDelivery(queueName);
 if (msgUnderDelivery.isPresent()) {
    try {
       handleMessage(msgUnderDelivery.get());
       durableQueues.acknowledgeMessageAsHandled(msgUnderDelivery.get().getId());
    } catch (Exception e) {
       durableQueues.retryMessage(msgUnderDelivery.get().getId(),
                                  e,
                                  Duration.ofMillis(500));
    }
 }
 

When using SingleOperationTransaction then depending on the type of errors that can occur this MAY leave a dequeued message in a state of being marked as "being delivered" forever
This is why DurableQueues supporting these modes must ensure that they periodically discover messages that have been under delivery for a long time (aka. stuck messages or timed-out messages) and reset them in order for them to be redelivered.

  • Enum Constant Details

  • Method Details

    • values

      public static TransactionalMode[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static TransactionalMode valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null