You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by Achim Nierbeck <bc...@googlemail.com> on 2013/09/11 10:12:27 UTC
ProducerTemplate without using Spring
Hi there,
I have a interesting setup right now using the ProducerTemplate.
I found the following:
http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
on how to add a global usable ProducerTemplate as your not supposed to
recreate the Producer template within every Process that needs to
communicate with a camel route.
Now I'm not able to use spring and therefore I'm looking for a way to
register a reusable ProducerTemplate so I'm able to access it via the
following in my CustomBeans.
ProducerTemplate template = context.getRegistry().lookup("template",
ProducerTemplate.class);
where context is the camel-Context.
Injection doesn't work for me as I'm calling this within EJBs, and worse I
needed to lookup the camel-context via jndi beforehand.
regards, Achim
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
RE: ProducerTemplate without using Spring
Posted by "Gershaw, Geoffrey A. (KFFC 223)" <ge...@credit-suisse.com>.
Hi,
Not a camel solution, but couldn't you load it once on startup of your app and keep it in an instance controlled class or singleton?
Geoffrey A Gershaw
Credit eTrading Development
+1 919 994 6412 (*102 6412)
-----Original Message-----
From: Achim Nierbeck [mailto:bcanhome@googlemail.com]
Sent: Monday, September 16, 2013 7:25 AM
To: users@camel.apache.org
Subject: Re: ProducerTemplate without using Spring
Hi again,
still looking for a way on how to solve this,
what is the best way of registering a Single ProducerTemplate without using
Spring?
Cause right now I still use the way of creating a producer Template every
time I need to communicate with
a Camel Route which sooner or later results in a issue which I did describe
at [1].
Thanks and regards, Achim
[1] - https://issues.apache.org/jira/browse/CAMEL-6695
2013/9/11 Achim Nierbeck <bc...@googlemail.com>
> Hi there,
>
> I have a interesting setup right now using the ProducerTemplate.
>
> I found the following:
>
> http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
> on how to add a global usable ProducerTemplate as your not supposed to
> recreate the Producer template within every Process that needs to
> communicate with a camel route.
> Now I'm not able to use spring and therefore I'm looking for a way to
> register a reusable ProducerTemplate so I'm able to access it via the
> following in my CustomBeans.
> ProducerTemplate template = context.getRegistry().lookup("template",
> ProducerTemplate.class);
> where context is the camel-Context.
> Injection doesn't work for me as I'm calling this within EJBs, and worse I
> needed to lookup the camel-context via jndi beforehand.
>
> regards, Achim
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
===============================================================================
Please access the attached hyperlink for an important electronic communications disclaimer:
http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html
===============================================================================
Re: ProducerTemplate without using Spring
Posted by Achim Nierbeck <bc...@googlemail.com>.
Hi again,
still looking for a way on how to solve this,
what is the best way of registering a Single ProducerTemplate without using
Spring?
Cause right now I still use the way of creating a producer Template every
time I need to communicate with
a Camel Route which sooner or later results in a issue which I did describe
at [1].
Thanks and regards, Achim
[1] - https://issues.apache.org/jira/browse/CAMEL-6695
2013/9/11 Achim Nierbeck <bc...@googlemail.com>
> Hi there,
>
> I have a interesting setup right now using the ProducerTemplate.
>
> I found the following:
>
> http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
> on how to add a global usable ProducerTemplate as your not supposed to
> recreate the Producer template within every Process that needs to
> communicate with a camel route.
> Now I'm not able to use spring and therefore I'm looking for a way to
> register a reusable ProducerTemplate so I'm able to access it via the
> following in my CustomBeans.
> ProducerTemplate template = context.getRegistry().lookup("template",
> ProducerTemplate.class);
> where context is the camel-Context.
> Injection doesn't work for me as I'm calling this within EJBs, and worse I
> needed to lookup the camel-context via jndi beforehand.
>
> regards, Achim
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
>
--
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
Commiter & Project Lead
blog <http://notizblog.nierbeck.de/>
Re: ProducerTemplate without using Spring
Posted by Claus Ibsen <cl...@gmail.com>.
When you create a CamelContext using new DefaultCamelContext you can
provide a custom registry. For example you can use SimpleRegistry. And
in this registry you can put the producer template, which your
bean/processor can lookup at runtime.
On Wed, Sep 11, 2013 at 10:12 AM, Achim Nierbeck
<bc...@googlemail.com> wrote:
> Hi there,
>
> I have a interesting setup right now using the ProducerTemplate.
>
> I found the following:
> http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html
> on how to add a global usable ProducerTemplate as your not supposed to
> recreate the Producer template within every Process that needs to
> communicate with a camel route.
> Now I'm not able to use spring and therefore I'm looking for a way to
> register a reusable ProducerTemplate so I'm able to access it via the
> following in my CustomBeans.
> ProducerTemplate template = context.getRegistry().lookup("template",
> ProducerTemplate.class);
> where context is the camel-Context.
> Injection doesn't work for me as I'm calling this within EJBs, and worse I
> needed to lookup the camel-context via jndi beforehand.
>
> regards, Achim
> --
>
> Apache Karaf <http://karaf.apache.org/> Committer & PMC
> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
> Project Lead
> OPS4J Pax for Vaadin <http://team.ops4j.org/wiki/display/PAXVAADIN/Home>
> Commiter & Project Lead
> blog <http://notizblog.nierbeck.de/>
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen
Re: ProducerTemplate without using Spring
Posted by Charles Moulliard <ch...@gmail.com>.
Hi Lucas,
This is correct. Here is a unit test part of the camel project where you
can see that we support 2 options (using @Produce annotation or @Inject
@Uri)
https://github.com/apache/camel/blob/master/components/camel-cdi/src/test/java/org/apache/camel/cdi/ProduceInjectTest.java
https://github.com/apache/camel/blob/master/components/camel-cdi/src/test/java/org/apache/camel/cdi/support/ProduceInjectedBean.java
Regards,
On Thu, Oct 16, 2014 at 8:25 PM, lucasweb <lu...@me.com> wrote:
> I'm using the camel-cdi component to inject ProducerTemplates into my EJB's
> e.g.
>
> @Inject
> @Uri("jms:ToolQueue?preserveMessageQos=true")
> ProducerTemplate toolQueueMessageProducer;
>
> My understanding is that the camel-cdi component should manage the look up
> and lifecycle of the producer template for me.
>
> Is this correct?
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/ProducerTemplate-without-using-Spring-tp5739099p5757633.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>
--
Charles Moulliard
Apache Committer / Architect @RedHat
Twitter : @cmoulliard | Blog : http://cmoulliard.github.io
Re: ProducerTemplate without using Spring
Posted by lucasweb <lu...@me.com>.
I'm using the camel-cdi component to inject ProducerTemplates into my EJB's
e.g.
@Inject
@Uri("jms:ToolQueue?preserveMessageQos=true")
ProducerTemplate toolQueueMessageProducer;
My understanding is that the camel-cdi component should manage the look up
and lifecycle of the producer template for me.
Is this correct?
--
View this message in context: http://camel.465427.n5.nabble.com/ProducerTemplate-without-using-Spring-tp5739099p5757633.html
Sent from the Camel - Users mailing list archive at Nabble.com.