a couple of comments... -from(..) invokes a component's Consumer, to(...) invokes its Producer -the component's Endpoint creates the exchange -the same exchange is used throughout a route -polling consumers are generally in the from() clause to initiate a route/exchange (except when using pollEnrich(), etc)
colr__ wrote: > > 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! > ----- Ben O'Day IT Consultant -http://consulting-notes.com -- View this message in context: http://camel.465427.n5.nabble.com/Exchange-lifecycle-tp4509898p4515525.html Sent from the Camel - Users mailing list archive at Nabble.com.
