Bob Paulin created CAMEL-16083:
----------------------------------

             Summary: OnCompletion with After Consumer mode does not fire if 
defined in routeScope
                 Key: CAMEL-16083
                 URL: https://issues.apache.org/jira/browse/CAMEL-16083
             Project: Camel
          Issue Type: Bug
          Components: camel-core
    Affects Versions: 3.7.1
         Environment: Java 11

Apache Karaf
            Reporter: Bob Paulin


After upgrading from Camel 3.7.0 to 3.7.1 we noticed a regression where routes 
that had onCompletion defined in the route scope no longer fired.  EX

 
{code:java}
    from("direct:start")
        .transform(constant("a"))
        .to("mock:a")
        .to("direct:sub")
        .transform(constant("c"))
        .to("mock:c");
 
    from("direct:sub")
         .transform(constant("b"))
         .to("mock:b")
         .onCompletion()
             .to("mock:end")
         .end(); {code}
 

In following the change made in CAMEL-13553 the onCompletion does not fire 
since the routeId of the direct:sub route where the onCompletion is scoped does 
not match the route id of direct:start where the onCompletion fires. 

This works fine if I move the onCompletion defintion into direct:start.

While on one hand this breaks our existing code it also makes me think it might 
just be a bad practice to define an AfterConsumerOnCompletion in a sub route.  
So perhaps this should not be supported? If it should be supported I think 
we'll need to evaluate the routeId compare in the after route so that we do the 
compare in the same scope as the definition.  Open to other suggestions.  Will 
provide a PR with a potential approach to the supported use case. 



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to