Record Class Option.FromLatestEvent

java.lang.Object
java.lang.Record
com.opencqrs.esdb.client.Option.FromLatestEvent
Record Components:
subject - the subject to read the latest event from
type - the Event.type() that the latest event must match
ifEventIsMissing - specifies the fall-back fetch strategy, in case there is no such event
All Implemented Interfaces:
Option
Enclosing interface:
Option

public static record Option.FromLatestEvent(@NotBlank String subject, @NotBlank String type, @NotNull Option.FromLatestEvent.IfEventIsMissing ifEventIsMissing) extends Record implements Option
Specifies that the list of events is optimized by omitting any event prior to the latest event available for the subject specified as part of this.

This is typically used to read so-called snapshot events from the given subject location in favor of consuming a much longer event stream for the actual subject being fetched.

  • Constructor Details

    • FromLatestEvent

      public FromLatestEvent(@NotBlank @NotBlank String subject, @NotBlank @NotBlank String type, @NotNull @NotNull Option.FromLatestEvent.IfEventIsMissing ifEventIsMissing)
      Creates an instance of a FromLatestEvent record class.
      Parameters:
      subject - the value for the subject record component
      type - the value for the type record component
      ifEventIsMissing - the value for the ifEventIsMissing record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • subject

      @NotBlank public @NotBlank String subject()
      Returns the value of the subject record component.
      Returns:
      the value of the subject record component
    • type

      @NotBlank public @NotBlank String type()
      Returns the value of the type record component.
      Returns:
      the value of the type record component
    • ifEventIsMissing

      @NotNull public @NotNull Option.FromLatestEvent.IfEventIsMissing ifEventIsMissing()
      Returns the value of the ifEventIsMissing record component.
      Returns:
      the value of the ifEventIsMissing record component