Your example using Camel would look something like:
from('rest:/api/myprocess') // using REST API endpoint as an example starting point
.inOut()
.to('activemq:main')
.to('activemq:mid')
.to('activemq:leaf')
.end()
Then you would define the handlers: from('activemq:main')
.transform { e ->
return new State(...)
}
from('activemq:mid')
.transform { e ->
e.body.number1 =
}
All the processing stages are happening asynchronously and results are passed back and forth by Camel. If things error out half way through you get a printout from Camel of the whole workflow including each step, where exactly it failed and what the content of the state was at that point (and it'll throw the lost message onto DLQ if you want to re-do the process).