Stream
View as MarkdownThis page lists the Rust SDK names for Streams. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Rust SDK API reference.
API names
| Task | Rust API | Dex behavior |
|---|---|---|
| Define a Stream and its byte capacity | Stream::new, with stream_capacity_bytes | Capacity and trimming |
| Declare it in the Flow | PersistenceSchema::stream, returned from Flow::persistence | Flow definition |
| Write a message from a Step | Stream::write | Write semantics |
| Write text chunks in batches from a Step | Stream::buffered_text and Stream::buffered_text_with_options, with BufferedTextStreamOptions | Buffer text chunks |
| Write a message from a Client | Client::write_stream | Write semantics |
| Read the next message | Client::read_stream or Client::read_stream_with_timeout, with the resume_token of the last message | Resumable reads |
| List retained messages, newest first | Client::list_stream_messages | List messages |
Stream::write works in wait_for, execute, and the Flow timeout handler. An RPC handler cannot write a Stream; there, Stream::write returns a HandlerError. Stream::write sends the message immediately.