On Mon, Jun 11, 2012 at 11:48 PM, boday <[email protected]>wrote:
> yes, there are multiple Endpoint instances as well (one per route > reference)... > > No that depends if your endpoint is singleton or not. If the producer and consumer have the exact uri, then they can share the same endpoint if its singleton. And in terms of lifecycle of the Camel components/endpoints/services etc, then read this http://camel.apache.org/lifecycle.html > If you need to share state between instances, then you can define it in the > Component class and pass into into endpoint/producer/consumer instances via > constructors. for an example of doing this, see camel-hazelcast, it passes > around references to hazelcastInstance to its producers/consumers > > > https://svn.apache.org/repos/asf/camel/trunk/components/camel-hazelcast/src/main/java/org/apache/camel/component/hazelcast/ > > otherwise, I suppose you could use class level variables in the > Endpoint/Consumer/Producer classes as well... > > > gilboy wrote > > > > So if there can be multiple Consumer & Producer instances in a given > > context (one per route reference), this would imply that there could be > > multiple instance of the Endpoint(again one per route reference)? > > > > I have a custom component where I need to share state between the > producer > > and the consumer for the same endpoint across different routes. Is this > > possible? > > > > Thanks > > Joe > > > > > ----- > Ben O'Day > IT Consultant -http://consulting-notes.com > > -- > View this message in context: > http://camel.465427.n5.nabble.com/Custom-Camel-Component-instantiated-twice-tp5714297p5714307.html > Sent from the Camel - Users mailing list archive at Nabble.com. > -- Claus Ibsen ----------------- FuseSource Email: [email protected] Web: http://fusesource.com Twitter: davsclaus, fusenews Blog: http://davsclaus.com Author of Camel in Action: http://www.manning.com/ibsen
