bobpaulin commented on pull request #4938:
URL: https://github.com/apache/camel/pull/4938#issuecomment-771066135


   Agree and Thank you @davsclaus .  I think allowing the onComplete code in 
After Consumer Mode in the sub-routes is a double edged sword.  On one hand I 
can define the onComplete once in the sub-route and attach it to unlimited 
calling consumers.  On the other hand coding this way disconnects the 
definition from where the code is going to be executed which could be 
confusing. The usecase I'm dealing with from code implemented on Camel 2.x code 
involved an event we wanted to fire as an async action triggered by something 
happening in a sub-route without slowing down the response to the client.  
While there are other approaches we could use to get this behavior After 
Consumer seemed like a natural fit so we did it that way.  The issue with the 
current implementation is that in After Consumer Mode the definition must be 
done in the consumer route directly (for example a rest definition) or it will 
never fire.  If this is something we're trying to make camel users adhere to 
then it wou
 ld be good to get an exception or perhaps even defaulting sub route 
onCompletion code to Before Consumer Mode.
   
   Both involve behavior changes which may or may not be acceptable.  Which is 
why I've offered a PR proposal to try to allow some compatibility which feels a 
bit heavy to get it to work.  However without access to the Route object in the 
onComplete(Exchange) method in the OnCompletion processor it seemed like the 
only way to ensure the After Consumer onComplete fired was to track the route 
id in the Exchange itself.  
   
   Thanks again for looking at this so quickly.   Happy to bring this 
discussion on list if more usecases might help in determining a path forward.
   
   


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to