davsclaus opened a new pull request, #24832:
URL: https://github.com/apache/camel/pull/24832

   ## Summary
   
   _Claude Code on behalf of davsclaus_
   
   `InMemorySagaCoordinator` keyed option values by `CamelSagaStep` identity 
(`Map<CamelSagaStep, Map<String, Object>>`). Since `SagaReifier` creates one 
step singleton per `saga()` DSL block, enlisting the same step multiple times 
in one saga (e.g. a loop/split calling a sub-route with `MANDATORY` 
propagation) caused each enlistment to overwrite the previous values. All 
compensation calls then received the **last** exchange's option values — silent 
data corruption.
   
   **Fix:** Replace the dual `steps` list + `optionValues` map with a single 
`List<StepEnlistment>`, where each enlistment pairs a step with its own 
independent option values map. This ensures each enlistment preserves its own 
evaluated options.
   
   Also includes the CAMEL-24146 fix (shared `ProducerTemplate` in 
`InMemorySagaService`) since both issues touch the same code.
   
   Changes:
   - `InMemorySagaCoordinator`: introduce `StepEnlistment` inner class, replace 
step-keyed storage with per-enlistment list
   - `InMemorySagaService`: add shared `ProducerTemplate` lifecycle 
(CAMEL-24146)
   - `SagaOptionsTest`: add `testOptionsPreservedOnRepeatedEnlistment` — 
enlists the same step twice with different `itemId` values, verifies each 
compensation receives its own value
   
   ## Test plan
   
   - [x] All 25 saga tests pass (24 existing + 1 new)
   - [x] New test `testOptionsPreservedOnRepeatedEnlistment` verifies both 
`item-A` and `item-B` are received in compensation
   
   Co-Authored-By: Claude Opus 4.6 <[email protected]>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to