[
https://issues.apache.org/jira/browse/CAMEL-18275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17568429#comment-17568429
]
Eduard Gomoliako commented on CAMEL-18275:
------------------------------------------
I'd love to contribute and provide a PR with the solution, and I'd need some
input.
In particular, I'd like to learn what was the design idea by making
`SedaProducer` handing over competitions to the exchange cope passed to the
SEDA route.
> onCompletion tasks don't get executed in a pipeline with several SEDA queues
> ----------------------------------------------------------------------------
>
> Key: CAMEL-18275
> URL: https://issues.apache.org/jira/browse/CAMEL-18275
> Project: Camel
> Issue Type: Bug
> Components: came-core
> Affects Versions: 3.18.0
> Reporter: Eduard Gomoliako
> Priority: Major
>
> I stumbled upon a problem with not working {{onCompletion}} between the
> routes that pass a message over SEDA queues.
> The route configuration is similar to this simplified version:
>
> {code:java}
> from("direct:a")
> .onCompletion().log("a - done").end()
> .to("seda:b");
> from("seda:b")
> .onCompletion().log("b - done").end()
> .to("seda:c");
> from("seda:c")
> .onCompletion().log("c - done").end()
> .to("seda:d");
> from("seda:d")
> .onCompletion().log("d - done").end()
> .to("mock:end"); {code}
>
> With this configuration, I get only {{"d - done"}} logging.
> I debugged the execution and noticed that the {{onCompletion}} handler from
> "a", "b", and "c" don't get executed because they are route-scoped and get
> attempted to be executed in the scope of the next route.
> This happens because they get handed over from the initial exchange to an
> exchange prepared for the next route. It happens in the
> {{SedaProducer::addToQueue}} method with {{{}copy{}}}parameter defined as
> {{{}true{}}}, which makes the {{::prepareCopy}} method being called, which in
> its turn calls {{ExchangeHelper.createCorrelatedCopy}} with {{handover}}
> defined as {{{}true{}}}.
> It seems to me like a bug, because looking at the routes configuration I'd
> expect different behavior: all the {{onCompletion}} tasks get executed
> reporting on routes finalization. Though maybe I'm missing something here,
> and if this is the case then I would appreciate you guys helping me to find
> out the missing details.
> Here is a [unit test reproducing the
> problem|https://gist.github.com/Gems/7555776feae619ac71ed8d9dd9d4d33e].
--
This message was sent by Atlassian Jira
(v8.20.10#820010)