Hard Resilience Patterns
Bulkhead with FlatMap Concurrency
Simulate the bulkhead pattern using flatMap concurrency. Create a Flux of task IDs 1 through 6 and process them with flatMap limited to 2 concurrent tasks. Each task should print "Processing task <id>" and return "Done <id>". Print results.
flatMap(mapper, concurrency) limits how many inner publishers run simultaneously.
Expected
Processing task 1 Done 1 Processing task 2 Done 2 Processing task 3 Done 3 Processing task 4 Done 4 Processing task 5 Done 5 Processing task 6 Done 6
Main.kt