Thnaks for your answer Ben, I actually already have that reference in my Producer class. The real issue is that I need to call a specific method (activate) on the datasource when a certain sentinel message has been received once from each route. That is why I want a singleton Producer, so that it can count the sentinel messages and activate the datasource when they have all been received.
If there are other ways to go about this, as a Camel newbie I'd be interested in any advice. Thanks a lot Andrew ben.oday wrote: > > I don't think you want to cache the Producer or you'll loose the > configuration for subsequent routes (as well as causing other issues I > imagine). Instead, I'd try to use a static (thread-safe) reference to > your datasource in your custom Producer class that can be shared across > instances. > > > andrew.cowper wrote: >> >> I am trying to have two routes which go to the same producer. Camel is >> creating two instances of the Producer though. >> >> How do I stop it doing that? Do I have to write code in my EndPoint to >> cache the Producer, and return the existing one when it is requested the >> second time? I was expecting camel to be able to cache the Producer for >> me. >> > -- View this message in context: http://camel.465427.n5.nabble.com/How-to-write-a-singleton-producer-tp4313843p4315208.html Sent from the Camel - Users mailing list archive at Nabble.com.
