camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From boday <ben.o...@initekconsulting.com>
Subject Re: Custom Camel Component instantiated twice
Date Mon, 11 Jun 2012 21:48:53 GMT
yes, there are multiple Endpoint instances as well (one per route
reference)...

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.

Mime
View raw message