io.enterpriseai.SseStream
Source: sdks/java/enterprise-ai-java/src/main/java/io/enterpriseai/SseStream.java. Back to the Java SDK reference index.
This page is generated by tools/docs/gen_sdk_reference.py from the SDK sources and the OpenAPI text folders. Do not edit it by hand: change the source and regenerate.
Class SseStream
Blocking Server-Sent Events reader. Use it with try-with-resources, as an Iterator, a Stream or a reactive Flow.Publisher. A data: [DONE] event ends the stream.
Iterator<SseEvent>, AutoCloseable
Constructor SseStream
SseStream(InputStream in)
Reads the events of a byte stream decoded as UTF-8.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
in | InputStream | yes | Body of the text/event-stream HTTP response. |
SseStream.close
void close()
Ends the stream and closes the reader; an already broken connection raises no error.
This element takes no parameter.
Returns: void.
SseStream.publisher
Flow.Publisher<SseEvent> publisher(Executor executor)
Reactive view honoring back pressure; events are read on the given executor.
| Name | Type | Default | Required | Description |
|---|---|---|---|---|
executor | Executor | yes | Executor on which the events are read. |
Returns: Flow.Publisher<SseEvent>. A SseEvent: One Server-Sent Event.
SseStream.stream
Stream<SseEvent> stream()
Lazy stream of the remaining events; closing the stream closes the connection.
This element takes no parameter.
Returns: Stream<SseEvent>. A SseEvent: One Server-Sent Event.