跳到主要内容

Stream

查看 Markdown

This page lists the Python SDK names for Streams. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Python SDK API reference.

API names​

TaskPython APIDex behavior
Define a Stream and its byte capacityStream, with stream_capacity_bytesCapacity and trimming
Declare it in the FlowPersistenceSchema.of, returned from get_persistence_schemaFlow definition
Write a message from a StepStream.writeWrite semantics
Write text chunks in batches from a StepStream.buffered_textBuffer text chunks
Write a message from a ClientClient.write_streamWrite semantics
Read the next messageClient.read_stream, 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. In a synchronous handler, Stream.write returns a StepOutput that the handler must yield. In an asynchronous handler, it enqueues the message and returns nothing.

Example​

Example: examples/python/dex_examples/primitives/stream/stream_flow.py