Package energy.eddie.outbound.rest.web
Class EventStream
java.lang.Object
energy.eddie.outbound.rest.web.EventStream
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final org.springframework.http.MediaTypestatic final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription<T> org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<T>> toJson(reactor.core.publisher.Flux<T> stream) <T> org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<String>> toXml(reactor.core.publisher.Flux<T> stream) Converts a flux of any type to a stream of XML documents, suitable for SSE endpoints.
-
Field Details
-
EVENT_STREAM_XML_VALUE
- See Also:
-
EVENT_STREAM_XML
public static final org.springframework.http.MediaType EVENT_STREAM_XML
-
-
Constructor Details
-
EventStream
- Throws:
SerdeInitializationException
-
-
Method Details
-
toXml
public <T> org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<String>> toXml(reactor.core.publisher.Flux<T> stream) Converts a flux of any type to a stream of XML documents, suitable for SSE endpoints. It changes theContent-Type-Header totext/event-stream, since otherwise clients are not able to receive any events. Drops objects that cannot be serialized to an XML document.- Type Parameters:
T- the type of the source of the events- Parameters:
stream- the source for the events- Returns:
- a stream of XML documents
-
toJson
public <T> org.springframework.http.ResponseEntity<reactor.core.publisher.Flux<T>> toJson(reactor.core.publisher.Flux<T> stream)
-