Record Class QueueMutation<T extends Serializable>

java.lang.Object
java.lang.Record
com.mimecast.robin.queue.QueueMutation<T>
Type Parameters:
T - payload type

public record QueueMutation<T extends Serializable>(QueueMutationType type, QueueItem<T extends Serializable> item, long nextAttemptAtEpochSeconds, String lastError) extends Record
One queue-state mutation produced by a dequeue worker.
  • Field Details

    • type

      private final QueueMutationType type
      The field for the type record component.
    • item

      private final QueueItem<T extends Serializable> item
      The field for the item record component.
    • nextAttemptAtEpochSeconds

      private final long nextAttemptAtEpochSeconds
      The field for the nextAttemptAtEpochSeconds record component.
    • lastError

      private final String lastError
      The field for the lastError record component.
  • Constructor Details

    • QueueMutation

      public QueueMutation(QueueMutationType type, QueueItem<T> item, long nextAttemptAtEpochSeconds, String lastError)
      Creates an instance of a QueueMutation record class.
      Parameters:
      type - the value for the type record component
      item - the value for the item record component
      nextAttemptAtEpochSeconds - the value for the nextAttemptAtEpochSeconds record component
      lastError - the value for the lastError record component
  • Method Details

    • acknowledge

      public static <T extends Serializable> QueueMutation<T> acknowledge(QueueItem<T> item)
    • reschedule

      public static <T extends Serializable> QueueMutation<T> reschedule(QueueItem<T> item, long nextAttemptAtEpochSeconds, String lastError)
    • dead

      public static <T extends Serializable> QueueMutation<T> dead(QueueItem<T> item, String lastError)
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared with Objects::equals(Object,Object); primitive components are compared with '=='.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • type

      public QueueMutationType type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • item

      public QueueItem<T> item()
      Returns the value of the item record component.
      Returns:
      the value of the item record component
    • nextAttemptAtEpochSeconds

      public long nextAttemptAtEpochSeconds()
      Returns the value of the nextAttemptAtEpochSeconds record component.
      Returns:
      the value of the nextAttemptAtEpochSeconds record component
    • lastError

      public String lastError()
      Returns the value of the lastError record component.
      Returns:
      the value of the lastError record component