Record Class EmptyAppendTransaction

java.lang.Object
java.lang.Record
org.axonframework.eventsourcing.eventstore.EmptyAppendTransaction
All Implemented Interfaces:
EventStorageEngine.AppendTransaction<Void>

public record EmptyAppendTransaction() extends Record implements EventStorageEngine.AppendTransaction<Void>
Represents an empty append transaction. This transaction does nothing and always succeeds. It is used when there are no events to persist.
Since:
5.0.0
Author:
Mateusz Nowak
  • Field Details

  • Constructor Details

    • EmptyAppendTransaction

      public EmptyAppendTransaction()
      Creates an instance of a EmptyAppendTransaction record class.
  • Method Details

    • commit

      public CompletableFuture<Void> commit()
      Description copied from interface: EventStorageEngine.AppendTransaction
      Commit any underlying transactions to make the appended events visible to consumers.

      Called during the COMMIT phase.

      Specified by:
      commit in interface EventStorageEngine.AppendTransaction<Void>
      Returns:
      A CompletableFuture to complete the commit asynchrously, returning a value for
      invalid reference
      afterCommit
      .
    • rollback

      public void rollback()
      Description copied from interface: EventStorageEngine.AppendTransaction
      Rolls back any events that have been appended, permanently making them unavailable for consumers.
      Specified by:
      rollback in interface EventStorageEngine.AppendTransaction<Void>
    • afterCommit

      public CompletableFuture<ConsistencyMarker> afterCommit(@Nullable Void commitResult)
      Always provides the consistency marker ConsistencyMarker.ORIGIN.
      Specified by:
      afterCommit in interface EventStorageEngine.AppendTransaction<Void>
      Parameters:
      commitResult - The result returned from the commit call.
      context - The current ProcessingContext, if any.
      Returns:
      An empty always a completed future with the consistency marker ConsistencyMarker.ORIGIN.
    • 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.
      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.