Interface OutboundSseEvent.Builder
- 
- Enclosing interface:
- OutboundSseEvent
 
 public static interface OutboundSseEvent.BuilderA builder class used for creatingOutboundSseEventinstances.
- 
- 
Method SummaryAll Methods Instance Methods Abstract Methods Modifier and Type Method Description OutboundSseEventbuild()BuildOutboundSseEvent.OutboundSseEvent.Buildercomment(String comment)Set comment string associated with the event.OutboundSseEvent.Builderdata(GenericType type, Object data)Set event data and a generic java type of event data.OutboundSseEvent.Builderdata(Class type, Object data)Set event data and java type of event data.OutboundSseEvent.Builderdata(Object data)Set event data and java type of event data.OutboundSseEvent.Builderid(String id)Set the event id.OutboundSseEvent.BuildermediaType(MediaType mediaType)Set themedia typeof the event data.OutboundSseEvent.Buildername(String name)Set event name.OutboundSseEvent.BuilderreconnectDelay(long milliseconds)Set reconnection delay (in milliseconds) that indicates how long the event receiver should wait before attempting to reconnect in case a connection to SSE event source is lost.
 
- 
- 
- 
Method Detail- 
idOutboundSseEvent.Builder id(String id) Set the event id.Will be send as a value of the SSE "id"field. This field is optional.- Parameters:
- id- event id.
- Returns:
- updated builder instance.
 
 - 
nameOutboundSseEvent.Builder name(String name) Set event name.Will be send as a value of the SSE "event"field. This field is optional.- Parameters:
- name- event name.
- Returns:
- updated builder instance.
 
 - 
reconnectDelayOutboundSseEvent.Builder reconnectDelay(long milliseconds) Set reconnection delay (in milliseconds) that indicates how long the event receiver should wait before attempting to reconnect in case a connection to SSE event source is lost.Will be send as a value of the SSE "retry"field. This field is optional.Absence of a value of this field in an OutboundSseEventinstance is indicated bySseEvent.RECONNECT_NOT_SETvalue returned fromSseEvent.getReconnectDelay().- Parameters:
- milliseconds- reconnection delay in milliseconds. Negative values un-set the reconnection delay.
- Returns:
- updated builder instance.
 
 - 
mediaTypeOutboundSseEvent.Builder mediaType(MediaType mediaType) Set themedia typeof the event data.This information is mandatory. The default value is MediaType.TEXT_PLAIN.- Parameters:
- mediaType-- MediaTypeof event data. Must not be- null.
- Returns:
- updated builder instance.
- Throws:
- NullPointerException- in case the- mediaTypeparameter is- null.
 
 - 
commentOutboundSseEvent.Builder comment(String comment) Set comment string associated with the event.The comment will be serialized with the event, before event data are serialized. If the event does not contain any data, a separate "event" that contains only the comment will be sent. This information is optional, provided the event data are set. Note that multiple invocations of this method result in a previous comment being replaced with a new one. To achieve multi-line comments, a multi-line comment string has to be used. - Parameters:
- comment- comment string.
- Returns:
- updated builder instance.
 
 - 
dataOutboundSseEvent.Builder data(Class type, Object data) Set event data and java type of event data.Type information will be used for MessageBodyWriterlookup.Note that multiple invocations of this method result in previous even data being replaced with new one. - Parameters:
- type- java type of supplied data. Must not be- null.
- data- event data. Must not be- null.
- Returns:
- updated builder instance.
- Throws:
- NullPointerException- in case either- typeor- dataparameter is- null.
 
 - 
dataOutboundSseEvent.Builder data(GenericType type, Object data) Set event data and a generic java type of event data.Type information will be used for MessageBodyWriterlookup.Note that multiple invocations of this method result in previous even data being replaced with new one. - Parameters:
- type- generic type of supplied data. Must not be- null.
- data- event data. Must not be- null.
- Returns:
- updated builder instance.
- Throws:
- NullPointerException- in case either- typeor- dataparameter is- null.
 
 - 
dataOutboundSseEvent.Builder data(Object data) Set event data and java type of event data.This is a convenience method that derives the event data type information from the runtime type of the event data. The supplied event data may be represented as GenericEntity.Note that multiple invocations of this method result in previous even data being replaced with new one. - Parameters:
- data- event data. Must not be- null.
- Returns:
- updated builder instance.
- Throws:
- NullPointerException- in case the- dataparameter is- null.
 
 - 
buildOutboundSseEvent build() BuildOutboundSseEvent.There are two valid configurations: - if a commentis set, all other parameters are optional. If eventdataandmedia typeis set, event data will be serialized after the comment.
- if a commentis not set, at least the eventdatamust be set. All other parameters are optional.
 - Returns:
- new OutboundSseEventinstance.
- Throws:
- IllegalStateException- when called with invalid configuration (neither a comment nor event data are set).
 
- if a 
 
- 
 
-