Skip to main content

Stream

View as Markdown

This 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​

TaskRust APIDex behavior
Define a Stream and its byte capacityStream::new, with stream_capacity_bytesCapacity and trimming
Declare it in the FlowPersistenceSchema::stream, returned from Flow::persistenceFlow definition
Write a message from a StepStream::writeWrite semantics
Write text chunks in batches from a StepStream::buffered_text and Stream::buffered_text_with_options, with BufferedTextStreamOptionsBuffer text chunks
Write a message from a ClientClient::write_streamWrite semantics
Read the next messageClient::read_stream or Client::read_stream_with_timeout, with the resume_token of the last messageResumable reads
List retained messages, newest firstClient::list_stream_messagesList 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.

Example​

Example: examples/rust/src/primitives/stream/flow.rs