Class OutboundEvent
- All Implemented Interfaces:
OutboundSseEvent,SseEvent
- Author:
- Pavel Bucek, Marek Potociar
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from interface jakarta.ws.rs.sse.SseEvent
RECONNECT_NOT_SET -
Method Summary
Modifier and TypeMethodDescriptionGet a comment string that accompanies the event.getData()Get event data.Get generic data type.getId()Get event identifier.Getmedia typeof the event data.getName()Get event name.longGet connection retry time in milliseconds the event receiver should wait before attempting to reconnect after a connection to the SSE source is lost.Class<?>getType()Get data type.booleanCheck if the connection retry time has been set in the event.
-
Method Details
-
getName
Get event name.This field is optional. If specified, will be send as a value of the SSE
"event"field. -
getId
Get event identifier.This field is optional. If specified, the value is send as a value of the SSE
"id"field. -
getReconnectDelay
public long getReconnectDelay()Get connection retry time in milliseconds the event receiver should wait before attempting to reconnect after a connection to the SSE source is lost.This field is optional. If specified, the value is send as a value of the SSE
"retry"field.- Specified by:
getReconnectDelayin interfaceSseEvent- Returns:
- reconnection delay in milliseconds or
SseFeature.RECONNECT_NOT_SETif no value has been set. - Since:
- 2.3
-
isReconnectDelaySet
public boolean isReconnectDelaySet()Check if the connection retry time has been set in the event.- Specified by:
isReconnectDelaySetin interfaceSseEvent- Returns:
trueif reconnection delay in milliseconds has been set in the event,falseotherwise.- Since:
- 2.3
-
getType
Get data type.This information is used to select a proper
MessageBodyWriterto be used for serializing theevent data.- Specified by:
getTypein interfaceOutboundSseEvent- Returns:
- data type. May return
null, if the event does not contain any data.
-
getGenericType
Get generic data type.This information is used to select a proper
MessageBodyWriterto be used for serializing theevent data.- Specified by:
getGenericTypein interfaceOutboundSseEvent- Returns:
- generic data type. May return
null, if the event does not contain any data. - Since:
- 2.3
-
getMediaType
Getmedia typeof the event data.This information is used to a select proper
MessageBodyWriterto be used for serializing theevent data.- Specified by:
getMediaTypein interfaceOutboundSseEvent- Returns:
- data
MediaType.
-
getComment
Get a comment string that accompanies the event.If specified, the comment value is sent with the event as one or more SSE comment lines (depending on line breaks in the actual data string), before any actual event data are serialized. If the event instance does not contain any data, a separate "event" that contains only the comment will be sent. Comment information is optional, provided the event data are set.
- Specified by:
getCommentin interfaceSseEvent- Returns:
- comment associated with the event.
-
getData
Get event data.The event data, if specified, are serialized and sent as one or more SSE event
"data"fields (depending on the line breaks in the actual serialized data content). The data are serialized using an availableMessageBodyWriterthat is selected based on the eventtype,getGenericType()generic type} andgetMediaType()media type}.- Specified by:
getDatain interfaceOutboundSseEvent- Returns:
- event data. May return
null, if the event does not contain any data.
-