OK, but that doesn't apply to an inject ProducerTemplate in a bean, only to
ones created on the incoming thread.

If you have something like. It is an *instance *variable. It is not created
on the incoming thread but is only created at start up time.

public class FooHandler {

@EndpointInject(uri="activemq:foo.bar")
  ProducerTemplate producer;

  public void doSomething() {
    if (whatever) {
      producer.sendBody("<hello>world!</hello>");
    }
  }

http://camel.apache.org/pojo-producing.html


Make sure you look at what they are conveying.  This not suggesting that
you create a singleton and serve up ProducerTemplates from it.  It is
saying you shouldn't create them inside the invocation (on the incoming
thread).  Specifically it says: *You are not meant to create a
ProducerTemplate for each message invocation; you are meant to create a
single instance on startup and keep it around.*

http://camel.apache.org/why-does-camel-use-too-many-threads-with-producertemplate.html

On Thu, Sep 8, 2016 at 10:50 PM, niteshjain <niteshjain...@gmail.com> wrote:

> Hi,
>
> Can you please look into this query:
> http://camel.465427.n5.nabble.com/Should-i-start-stop-
> producer-templates-often-td5787400.html
>
> any help is appreciated.
>
> Thanks,
> Nithesh
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.
> com/ProducerTemplate-creates-too-much-threads-tp5751299p5787401.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Reply via email to