The two scenarios are actually identical. The routes should be treated totally independent. One could use all kinds of protocols between the two routes and things should still not change.
scenario N ========= from bar:A onCompletion -> "mock:a" end to XXX to foo:b -- optional -- to WWW to ZZZ from foo:b onCompletion -> "mock:b" end to YYY Exchange transferred or not, the first that triggers is mock:b regardless if the Exchange flowing on route B originated from route A or another route or another client. Once route A completes, regardless if there were other processors after "to foo:b" and regardless if one processor on the route happened to be a SendProcessor on a seda: endpoint, or not, the second on complete should take place on mock:a. The second onComplete must also trigger in the context of route A (meaning that the fromEndpoint on the Exchange should also point to bar:A) Which is I believe what happens now. From your analysis Claus, if I understand correctly, this is not exactly the case for the seda component, in which case we should fix it there. I don't see a need for an atThisRouteOnly option. Cheers, Hadrian On Jan 17, 2011, at 5:53 AM, Claus Ibsen wrote: > Hi > > In Camel we have on completions > http://camel.apache.org/oncompletion.html > > Which support 2 scope levels: context or route. > > There is a rules of thumb currently: > - If you define a route scope it overrides all global scoped. So its > either or (not both). > > The issue I would like to discuss is this scenario: > - If you route an exchange using multiple routes, eg send the exchange > using direct/seda to another route with route scoped onCompletion > > > Then this end user came up with this scenario > http://camel.465427.n5.nabble.com/error-handling-and-transaction-question-tp3341490p3341490.html > > > > scenario 1 > ========= > from direct:A > onCompletion -> "mock:a" end > to XXX > to direct:b > > from direct:b > onCompletion -> "mock:b" end > to YYY > > In this example the exchange is routed from A -> B using direct, which > means that after route B the the Exchange will continue at route A, > but there are no more outputs in the route so its done. > > What onCompletions would you expect to trigger? > > a) only "mock:a" because the Exchange is done at route A > b) both "mock:a" and "mock:b because the Exchange is done (regardless > in which route) > > Currently its b what's implemented in Camel 2.5 > > > Now the scenario changes a bit as we use seda endpoints > > Scenario 2 > ======== > > > from direct:A > onCompletion -> "mock:a" end > to XXX > to seda:b > > from seda:b > onCompletion -> "mock:b" end > to YYY > > In this example the exchange is routed from A -> B using seda, which > means the exchange is transferred from A -> B and the on completions > will be handed over. > So when the exchange reaches the end of route B its done (it doesnt > continue routing in route A). > > What onCompletions would you expect to trigger? > > a) only "mock:b" because the Exchange is done at route B > b) both "mock:a" and "mock:b because the Exchange is done (regardless > in which route) > > Currently its b what's implemented in Camel 2.5 > > > The issues > ======== > > 1) > Should we change the default behavior to let Camel trigger route > scoped on completions *only* if the exchange is done at that given > route? > > 2) > Or should we leave it as is? > > 3) > Or add a new option to route scoped onCompletion so end user can > decide? (atThisRouteOnly) = the new option (find a better name for it) > > onCompletion atThisRouteOnly -> "mock:a" end > > And if so, what should the default option for it be? > > > -- > Claus Ibsen > ----------------- > FuseSource > Email: [email protected] > Web: http://fusesource.com > Twitter: davsclaus > Blog: http://davsclaus.blogspot.com/ > Author of Camel in Action: http://www.manning.com/ibsen/
