Package org.a2aproject.sdk.client.http
Record Class ServerSentEvent
java.lang.Object
java.lang.Record
org.a2aproject.sdk.client.http.ServerSentEvent
public record ServerSentEvent(String data, String eventType, @Nullable String id, @Nullable Long retry)
extends Record
Represents a parsed Server-Sent Event (SSE).
Each instance carries the fields defined by the SSE specification:
data— the event payload, already concatenated from one or moredata:lineseventType— the event type from theevent:field; never null, defaults to"message"id— the event ID from theid:field; null if absentretry— the reconnection interval in milliseconds from theretry:field; null if absent
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringDefault event type per the SSE specification when noevent:field is present. -
Constructor Summary
ConstructorsConstructorDescriptionServerSentEvent(String data) ServerSentEvent(String data, String eventType, @Nullable String id, @Nullable Long retry) Creates an instance of aServerSentEventrecord class. -
Method Summary
Modifier and TypeMethodDescriptiondata()Returns the value of thedatarecord component.final booleanIndicates whether some other object is "equal to" this one.Returns the value of theeventTyperecord component.final inthashCode()Returns a hash code value for this object.@Nullable Stringid()Returns the value of theidrecord component.@Nullable Longretry()Returns the value of theretryrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
DEFAULT_EVENT_TYPE
Default event type per the SSE specification when noevent:field is present.- See Also:
-
-
Constructor Details
-
ServerSentEvent
Creates an instance of aServerSentEventrecord class.- Parameters:
data- the value for thedatarecord componenteventType- the value for theeventTyperecord componentid- the value for theidrecord componentretry- the value for theretryrecord component
-
ServerSentEvent
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
data
Returns the value of thedatarecord component.- Returns:
- the value of the
datarecord component
-
eventType
Returns the value of theeventTyperecord component.- Returns:
- the value of the
eventTyperecord component
-
id
Returns the value of theidrecord component.- Returns:
- the value of the
idrecord component
-
retry
Returns the value of theretryrecord component.- Returns:
- the value of the
retryrecord component
-