You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "Eduard (Jira)" <ji...@apache.org> on 2022/07/17 15:06:00 UTC

[jira] [Created] (CAMEL-18275) onCompletion tasks don't get executed in a pipeline with several SEDA queues

Eduard created CAMEL-18275:
------------------------------

             Summary: 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


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)