What are Channels?
Channels are communication endpoints that allow external systems to send data into a running workflow. They’re useful for:- Waiting for user approvals or input
- Receiving notifications from external systems
- Implementing interactive workflows
- Coordinating between workflows
- Building event-driven workflows
Creating Channels
Basic Usage
Receiving Signals
Thereceive() method returns a Deferred<T> that completes when a signal is received:
Sending Signals
By Workflow ID
Send signals to a specific workflow instance:By Workflow Tag
Send signals to workflows identified by tags:Filtered Signals
Using JsonPath
Filter signals based on their content using JsonPath expressions:Using Criteria
Use Jayway JsonPath criteria for more complex filtering:Type-Specific Channels
Receiving Specific Types
Receive only signals of a specific type from a polymorphic channel:Combining Type Filtering with JsonPath
Multiple Signals
Receive multiple signals on the same channel by specifying a limit:Racing Channels with Timers
Useor() to wait for either a channel signal or a timer:
Multiple Channels
Workflows can have multiple channels for different types of signals:Checking Channel Status
Check if a signal has been received without waiting:Channel Signal Ordering
Signals sent to a channel are processed in order:Complete Example
Here’s a complete example of an approval workflow with timeout and cancellation:Best Practices
Use descriptive channel names
Use descriptive channel names
Name channels clearly to indicate their purpose:
Always add timeouts
Always add timeouts
Don’t wait indefinitely for signals:
Use type-specific channels for polymorphic data
Use type-specific channels for polymorphic data
Filter by type when receiving different event types:
Validate signals
Validate signals
Always validate received signals:
Next Steps
Timers
Learn about timers and delays
Sub-workflows
Compose workflows from other workflows
Versioning
Update workflows while maintaining compatibility
Workflow Methods
Complete workflow method reference