Package com.axelor.ai.chat.stream
Class StreamSubscription
java.lang.Object
com.axelor.ai.chat.stream.StreamSubscription
- All Implemented Interfaces:
AutoCloseable
Subscriber side of one run: replays chunks from the cache, then tails until the run ends. The
topic is only a wake-up signal — every wake (or poll timeout) reads
head and emits any
chunks between the last emitted seq and head, so missed signals cannot lose data.-
Nested Class Summary
Nested Classes -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidpump(StreamSubscription.ChunkConsumer consumer, Duration maxDuration) Streams chunks toconsumeruntil the run is done ormaxDurationelapses.
-
Method Details
-
pump
public void pump(StreamSubscription.ChunkConsumer consumer, Duration maxDuration) throws IOException Streams chunks toconsumeruntil the run is done ormaxDurationelapses. ConsumerIOExceptions propagate — the caller treats them as "client disconnected" and simply detaches; the run is unaffected.- Throws:
IOException
-
close
public void close()- Specified by:
closein interfaceAutoCloseable
-