Reputation: 373
I have a running Scheduled Singleton, that's collecting data from Couchbase DB nodes through REST API, and I also have a Camel component which is responsible for sending Error reports and statistics to an external tool. Other Camel components in our system can use this "Error reporting" Endpoint just fine. How can i make my singleton useful in this setting? (I'm looking for something like in a Junit Test for Camel, the ProducerTemplate.)
Upvotes: 1
Views: 804
Reputation: 22279
If you really can't grab the Camel Context you have a few other options.
If you are in the same JVM and have camel-core in the startup classpath - fire up another CamelContext and use the direct-vm or vm component.
If you are comfortable with JMX, you can access your Camel context via JMX and send a message to any endpoint using that protocol. A bit of boiler plate, but does not require you to be in the same JVM or even same machine.
Fire up an embedded ActiveMQ and use that for inter module communication. I like this approach since it's probably easier than JMX and very easy to de couple the sender/receiver from each other (say you want to send from another system). However, some performance overhead.
Use any other direct external protocol. ZMQ, jetty/http,RMI. Each with their own drawback or benefit. Depends a bit on your knowledge and requirements (if you are a RMI guru, you may think that's a nice path).
Upvotes: 3