Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Its better to either explicitly create one on startup or get your IoC container (Spring or Guice) to inject it into your Processor or bean then it can take care of creating it and destroying all the resources when you have finished with it.

For instance using Spring you can define a template and have Spring handle the lifecycle of it:

Code Block
xml
xml

    <camelContext xmlns="http://activemq.apache.org/camel/schema/spring">
        <template id="template"/>
    </camelContext>

Then you can refer to the ProducerTemplate with the id template