Enum TransactionalMode

  • All Implemented Interfaces:
    Serializable, Comparable<TransactionalMode>

    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.

    • Method Detail

      • values

        public static TransactionalMode[] values()
        Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
        for (TransactionalMode c : TransactionalMode.values())
            System.out.println(c);
        
        Returns:
        an array containing the constants of this enum type, in the order they are declared
      • valueOf

        public static TransactionalMode valueOf​(String name)
        Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (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 type has no constant with the specified name
        NullPointerException - if the argument is null