mirror of
https://github.com/langgenius/dify.git
synced 2026-03-04 15:26:21 +08:00
692 B
692 B
Command Channels
Channel implementations for external workflow control.
Components
InMemoryChannel
Thread-safe in-memory queue for single-process deployments.
fetch_commands()- Get pending commandssend_command()- Add command to queue
RedisChannel
Redis-based queue for distributed deployments.
fetch_commands()- Get commands with JSON deserializationsend_command()- Store commands with TTL
Usage
# Local execution
channel = InMemoryChannel()
channel.send_command(AbortCommand(graph_id="workflow-123"))
# Distributed execution
redis_channel = RedisChannel(
redis_client=redis_client,
channel_key="workflow:123:commands"
)