Hi -
I have written a Component/Endpoint/Producer/Consumer set for my datasource.
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.
Here's some example routes. I only want one instance of MyProducer to be
created.
Thanks a lot for any help.
<bean id="my-src" class="me.camel.MyComponent"/>
<camel:camelContext>
<camel:endpoint id="serverEP"
uri="my-src://server?param1=one" />
<camel:route>
<camel:from uri="my-src://client1?param=value"/>
<camel:process ref="transform" />
<camel:to ref="serverEP" />
</camel:route>
<camel:route>
<camel:from
uri="my-src://client2?param=another-value"/>
<camel:to ref="serverEP" />
</camel:route>
</camel:camelContext>
--
View this message in context:
http://camel.465427.n5.nabble.com/How-to-write-a-singleton-producer-tp4313843p4313843.html
Sent from the Camel - Users mailing list archive at Nabble.com.