Event Stream
Streaming is built around IEventStream<T> with a concrete EventStream<BaseEvent> implementation.
IEventStream
Core methods:
void next(T event)— emit an eventvoid error(Throwable error)— signal error and terminatevoid complete()— signal completionboolean isCancelled()— check cancellation (for cooperative cancellation)
EventStream
Utility implementation that accepts three lambdas: onNext, onError, onComplete. Used by AbstractAgent and Spring AgUiService.
IEventStream<BaseEvent> stream = new EventStream<>(
event -> { /* handle event */ },
error -> { /* handle error */ },
() -> { /* handle complete */ }
);