Hello,

I have a route "A" which calls a route "B", route "B" adds some headers,
removes some others, changes the body, etc. Is there a way how I can call
route "B" from route "A", wait for route "B" to finish and once route "B"
returns, route "A" will be in the same state as before calling route "B"
(i.e. - same headers, same body)?

I tried using the SEDA component with the "waitForTaskToComplete" set to
"Always" but this does not seem to work, i.e. - if I use
InOnly("seda:B?waitForTaskToComplete=Always") then this works as if calling
the SEDA component with inOut(...).

For example:

[code]
                from("seda:A")
                        .log("Hello From A")
                        .setHeader("MyHeader", constant("A-HEADER"))
                        .transform(constant("A-BODY"))
                        .inOnly("seda:B?waitForTaskToComplete=Always")
                        .log("MyHeader is ${in.header.MyHeader}")
                        .log("Body is ${body}")
                ;
                
                from("seda:B")
                        .log("Hello From B")
                        .setHeader("MyHeader", constant("B-HEADER"))
                        .transform(constant("B-BODY"))
                        .log("Ready from B")
                ;
[/code]

Will Print:

[(camel-1) thread #0 - seda://A] route2                         INFO  Hello
>From A
[(camel-1) thread #1 - seda://B] route3                         INFO  Hello
>From B
[(camel-1) thread #1 - seda://B] route3                         INFO  Ready
from B
[(camel-1) thread #0 - seda://A] route2                         INFO 
MyHeader is B-HEADER
[(camel-1) thread #0 - seda://A] route2                         INFO  Body
is B-BODY

I was under the impression that calling seda:B with InOnly would force the
component not to return however it seems that waitForTaskToComplete=Always
makes it work like InOut rather than just wait for the task to complete.

Is there a way how I can achieve the above? i.e. - call a route, wait for
this to finish, but message from the caller route (in my case "A") remains
the same as before calling the second route.




--
View this message in context: 
http://camel.465427.n5.nabble.com/How-to-call-a-route-wait-to-finish-and-ignore-any-changes-when-this-returns-tp5792288.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to