简体   繁体   中英

Creating multiple sessions of Topic tibco ems when connecting to storm bolts through apache-camel

I am working on apache storm and I plan to connect the end bolts to pass messages to a topic of tibco-ems using Apache-camel through a single tibco-ems connection, but each instance of the bolt should have a separate session with the topic to avoid overloading as the amount of messages to be transferred is huge. How do I create separate sessions ? I have instantiated the camel-context in the prepare method of the bolt class and the routes and tibco ems connection is being instantiated in the config file.

camel-context is instantiated according to the solution in the below link: Using Apache Camel ProducerTemplate in Apache Storm bolt

I'm a little confused when you say "tibco ems connection is being instantiated in the config file".

Remember prepare is going to execute once for each instance of your bolt , so this is where you would initialize your connection to tibco ems. Just like ProducerTemplate you could make your connection transient since you'll re-use over and over again in execute .

Take a look at my other answer here: Execution flow of a storm program

Lastly, you control how many instances of your bolt you want when you setup the topology.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM