The Author Online Book Forums are Moving

The Author Online Book Forums will soon redirect to Manning's liveBook and liveVideo. All book forum content will migrate to liveBook's discussion forum and all video forum content will migrate to liveVideo. Log in to liveBook or liveVideo with your Manning credentials to join the discussion!

Thank you for your engagement in the AoF over the years! We look forward to offering you a more enhanced forum experience.

342855 (2) [Avatar] Offline

I'm trying to use RabbitMq and storm in my application. I followed the example in the book where the ConnectionFactory is created in the open method.

My questions are as below:

1. Just for my understanding, would that create a separate connection for each of the tasks defined for the spout? Meaning, if I had a topology with a single worker, 2 executors and 4 tasks for the spout, would it then create 8 connections?

2. If I made the connection factory a singleton, is that instance a singleton inside of the worker?

3. I would like to use DefaultConsumer instead of QueueingConsumer for HA. I'm not sure how that would fit in. Because, the default consumer works via callbacks as well; unless I queue the messages internally in my spout for nextTuple to emit. Would there be any threading issues if I use DefaultConsumer?

sean.allen (19) [Avatar] Offline
1. Yes that would be 8 connections.
2. Yes, singletons are per jvm worker. 1 connection for multiple spouts probably isn't what you want if that is what you are thinking of doing.
3. We don't use DefaultConsumer so I'm not familiar enough with it to answer that question. If you open a connection per thread like you see in the book, then you shouldn't have to worry about threading concerns as you aren't sharing anything between them.

Can you provide more context around what you are trying to accomplish?