Using addBulk
TheaddBulk method on FlowProducer allows you to add multiple flows in a single atomic operation:
Atomic Execution
This call can only succeed or fail - all or none of the jobs will be added. This ensures data consistency when adding multiple related flows.The
addBulk method returns an array of JobNode objects, one for each flow added.FlowJob Interface
Each flow in the array follows the sameFlowJob interface as the add method:
Example Use Cases
Batch Processing Multiple Workflows
Batch Processing Multiple Workflows
When you need to create multiple independent workflows that should all be created together or not at all:
Performance Optimization
Performance Optimization
Reduce Redis roundtrips by adding multiple flows at once instead of calling
add multiple times:Benefits
Atomicity
All flows are added or none are - ensures data consistency
Performance
Reduces Redis roundtrips for better performance
Error Handling
Simpler error handling - single point of failure
Transactional
Guarantees all-or-nothing behavior
