Class OutboundEvent
- All Implemented Interfaces:
OutboundSseEvent
,SseEvent
- Author:
- Pavel Bucek, Marek Potociar
-
Nested Class Summary
-
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 type
of the event data.getName()
Get event name.long
Get 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.boolean
Check 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:
getReconnectDelay
in interfaceSseEvent
- Returns:
- reconnection delay in milliseconds or
SseFeature.RECONNECT_NOT_SET
if 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:
isReconnectDelaySet
in interfaceSseEvent
- Returns:
true
if reconnection delay in milliseconds has been set in the event,false
otherwise.- Since:
- 2.3
-
getType
Get data type.This information is used to select a proper
MessageBodyWriter
to be used for serializing theevent data
.- Specified by:
getType
in 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
MessageBodyWriter
to be used for serializing theevent data
.- Specified by:
getGenericType
in interfaceOutboundSseEvent
- Returns:
- generic data type. May return
null
, if the event does not contain any data. - Since:
- 2.3
-
getMediaType
Getmedia type
of the event data.This information is used to a select proper
MessageBodyWriter
to be used for serializing theevent data
.- Specified by:
getMediaType
in 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:
getComment
in 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 availableMessageBodyWriter
that is selected based on the eventtype
,getGenericType()
generic type} andgetMediaType()
media type}.- Specified by:
getData
in interfaceOutboundSseEvent
- Returns:
- event data. May return
null
, if the event does not contain any data.
-