Federico Mariani created CAMEL-24149:
----------------------------------------

             Summary: camel-saga: saga:complete / saga:compensate only read the 
Long-Running-Action header - MANUAL completion broken after removeHeaders
                 Key: CAMEL-24149
                 URL: https://issues.apache.org/jira/browse/CAMEL-24149
             Project: Camel
          Issue Type: Bug
          Components: camel-core
            Reporter: Federico Mariani
         Attachments: SagaProducerRemoveHeadersIssueTest.java

h3. Problem

CAMEL-23469 made the Saga EIP resilient to {{removeHeaders("*")}} by storing 
the saga id in the ExchangeExtension and falling back to the header 
({{SagaProcessor.getCurrentSagaCoordinator}}, 
core/camel-core-processor/src/main/java/org/apache/camel/processor/saga/SagaProcessor.java:57-69).

{{SagaProducer}} was not updated - it reads only the header 
(components/camel-saga/src/main/java/org/apache/camel/component/saga/SagaProducer.java:47):

{code:java}
String currentSaga = 
exchange.getIn().getHeader(SagaConstants.SAGA_LONG_RUNNING_ACTION, 
String.class);
{code}

h3. Consequence

A MANUAL-completion saga route that strips headers (e.g. {{removeHeaders("*")}} 
before calling an external system, or hardening patterns that strip protocol 
headers) gets {{IllegalStateException: Current exchange is not bound to a saga 
context}} from {{saga:complete}}/{{saga:compensate}} even though the saga id is 
still tracked in the extension.

Minor related nit: that error message is hardcoded - {{saga:compensate}} 
failures also say "cannot complete" (SagaProducer.java:49-50).

h3. Reproducer

Attached {{SagaProducerRemoveHeadersIssueTest.java}} (goes into 
{{core/camel-core/src/test/java/org/apache/camel/component/saga/}}): 
{{testManualCompleteAfterRemoveHeaders}} and 
{{testManualCompensateAfterRemoveHeaders}} fail on current main; the control 
test without {{removeHeaders}} passes, isolating the regression to 
{{SagaProducer}}.

h3. Suggested fix

Mirror the processor logic in {{SagaProducer}}: read the ExchangeExtension 
first, fall back to the header. Test gap: {{SagaRemoveHeadersTest}} covers the 
EIP but not the {{saga:}} component.

Found during a broader Saga EIP / camel-lra code review (July 2026).

_Claude Code on behalf of Croway_



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to