Record Class ServerSentEvent

java.lang.Object
java.lang.Record
io.axoniq.framework.springcloud.query.ServerSentEvent
Record Components:
id - the event's identifier, or null when the event carried none. A member reconnecting to a stream reports the last identifier it saw, letting the serving member resume where it left off.
event - the event's type, naming what the data holds. Defaults to DEFAULT_EVENT_TYPE when the stream did not name one, as the protocol prescribes.
data - the event's payload. Multiple data lines in one event are joined with newlines, so this is the payload as the sending member wrote it.

public record ServerSentEvent(@Nullable String id, String event, String data) extends Record
A single event read from a Server-Sent Events stream.
Since:
5.4.0
Author:
Allard Buijze
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    The event type of an event that did not name one.
  • Constructor Summary

    Constructors
    Constructor
    Description
    ServerSentEvent(@Nullable String id, String event, String data)
    Compact constructor rejecting a missing event or data.
  • Method Summary

    Modifier and Type
    Method
    Description
    Returns the value of the data record component.
    final boolean
    Indicates whether some other object is "equal to" this one.
    Returns the value of the event record component.
    final int
    Returns a hash code value for this object.
    @Nullable String
    id()
    Returns the value of the id record component.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Field Details

    • DEFAULT_EVENT_TYPE

      public static final String DEFAULT_EVENT_TYPE
      The event type of an event that did not name one.
      See Also:
  • Constructor Details

    • ServerSentEvent

      public ServerSentEvent(@Nullable String id, String event, String data)
      Compact constructor rejecting a missing event or data.
  • 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.
    • id

      public @Nullable String id()
      Returns the value of the id record component.
      Returns:
      the value of the id record component
    • event

      public String event()
      Returns the value of the event record component.
      Returns:
      the value of the event record component
    • data

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