Stream
查看 MarkdownThis page lists the Java SDK names for Streams. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Java SDK API reference.
API names
| Task | Java API | Dex behavior |
|---|---|---|
| Define a Stream and its byte capacity | Stream.define, with streamCapacityBytes | Capacity and trimming |
| Declare it in the Flow | PersistenceSchema.of, returned from getPersistenceSchema | Flow definition |
| Write a message from a Step | Stream.write | Write semantics |
| Write text chunks in batches from a Step | BufferedTextStream.create | Buffer text chunks |
| Write a message from a Client | Client.writeStream | Write semantics |
| Read the next message | Client.readStream, with the getResumeToken value of the last message | Resumable reads |
| List retained messages, newest first | Client.listStreamMessages | List messages |
Stream.write works in waitFor, execute, and the Flow timeout handler. An RPC handler cannot write a Stream; there, the call throws IllegalStateException. Stream.write sends the message immediately.
Example
Example: examples/java/src/main/java/io/superdurable/dex/primitives/stream/StreamFlow.java