Channel
查看 MarkdownThis page lists the Python SDK names for Channels. The doc comment of each API gives its parameters, defaults, and errors. Read them in the Python SDK API reference.
API names
| Task | Python API | Dex behavior |
|---|---|---|
| Define a Channel | Channel | Channels |
| Define a ChannelMap | ChannelMap | ChannelMap |
| Declare it in the Flow | PersistenceSchema.of, returned from get_persistence_schema | Flow definition |
| Publish a message from a Step or RPC | publish | Commits |
| Wait for messages | for_one, for_n, at_least, at_most, and for_range | Wait conditions |
| Read the messages a wait consumed | results | Channel results |
| Load pending messages for a method | ChannelMap.load_messages, with the load fields of StepOptions or @rpc | Selective state loading |
| Read loaded pending messages | pending_messages and find_pending_message | Pending messages |
| Delete a pending message | delete | Pending messages |
| Read the number of pending messages | size | Selective state loading |
| Count ChannelMap instances and list their keys | ChannelMap.get_map_size and ChannelMap.get_all_instance_keys | ChannelMap |
| Complete the Flow only when Channels are empty | force_complete_if_channels_empty | ForceCompleteIfChannelsEmpty |
Example
Example: examples/python/dex_examples/primitives/channel/channel_flow.py