File tree Expand file tree Collapse file tree 2 files changed +39
-1
lines changed
Expand file tree Collapse file tree 2 files changed +39
-1
lines changed Original file line number Diff line number Diff line change 1+ # Batch Processing Sample
2+
3+ This sample demonstrates how to process large batches of tasks with controlled concurrency using Cadence's ` x.NewBatchFuture ` functionality.
4+
5+ ## What it does
6+
7+ - Creates a configurable number of activities (default: 10)
8+ - Executes them with controlled concurrency (default: 3)
9+ - Simulates work with random delays (900-999ms per task)
10+ - Handles cancellation gracefully
11+
12+ ## Real-world use cases
13+
14+ - Batch data processing
15+ - Bulk operations
16+ - ETL jobs
17+ - Report generation
18+ - File processing
19+
20+ ## How to run
21+
22+ Start Worker:
23+ ``` bash
24+ ./bin/batch -m worker
25+ ```
26+
27+ Start Workflow:
28+ ``` bash
29+ ./bin/batch -m trigger
30+ ```
31+
32+ ## Key concepts
33+
34+ - ** Batch processing** : Process multiple tasks efficiently
35+ - ** Concurrency control** : Limit simultaneous executions
36+ - ** Activity factories** : Lazy evaluation of activities
37+ - ** Future-based execution** : Asynchronous task management
38+ - ** Context cancellation** : Graceful handling of timeouts
Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ func startWorkflow(h *common.SampleHelper) {
3535
3636 // Default batch configuration
3737 input := BatchWorkflowInput {
38- Concurrency : 2 ,
38+ Concurrency : 3 ,
3939 TotalSize : 10 ,
4040 }
4141
You can’t perform that action at this time.
0 commit comments