Hi experts I am new to camel and I am running fuse esb 4.2.0
1. I have a class method ,invoked every time the client requests.and that class can not be instantiated/injected from spring configuration because it is dynamically loaded using forClass() method.
2. in that class method, I have the DefaultCamelContext and send the message to activemq queue using ProducerTemplate.sendBodyAndHeader() method.
3. so that class method is creating and starting the context every time it is invoked.
4. is it safe to do in the production systems? (creating and starting CamelContext again and again)
5. Is there any other way to explicitly send the Exchange to an endpoint? because when I read about RouteBuilder.configure() method, the source endpoint always starts with an endpoint from another location or at least the timer/quartz. In my case the source does not come from any route, I need to create the message explicitly and send the message to broker using ProducerTemplate.
Is there any good practice to follow the above situation.
Thank you experts
See this FAQ
I would advice to create a single instance of CamelContext and then re-use it in your bean.
Then you don't have the overhead of starting/stopping CamelContext and the JMS stuff.