I've been reading through 'Camel in Action' and have a question about the
lifecycle of an Exchange. The book  states the following:

"when a message needs to be sent to an endpoint, the producer will create an
exchange"
an also
"A consumer ... receives messages produced by a producer, wraps them in an
exchange ..."

This implies that both the consumer and the producer creates the Exchange
object, however the API documentation for the Exchange class states only
that the consumer will create the Exchange.

I'm a bit confused as to when the Exchange is created, and it's lifecycle.
If I have the following route:

.from(A)
.to(B)
.to(C)

Am I correct in thinking that an Exchange is created by consumer A and will
exist right up to the end of producer C? Or is there a separate Exchange
created for A-B, then for B-C?

If A, B and C are all polling consumers, then as I understand it they all
run independently of each other, so while it looks in the DSL that A
directly feeds the result to B to form a connected route, behind the scenes
A simply produces the result which then gets picked up by B as an
independent process. Is this correct? I think this is the root of my
confusion, as if they are independant processes then I dont see how the same
Exchange could be passed from A - B - C (since they are independent!).

Thanks in advance!


--
View this message in context: 
http://camel.465427.n5.nabble.com/Exchange-lifecycle-tp4509898p4509898.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Reply via email to