[rabbitmq-discuss] Creating New Consumers When a Consumer Dies Prematurely

Justin Field justin.field at cbsinteractive.com
Tue Jul 17 18:47:53 BST 2012


Hello,

I am trying to use rabbitMQ to rebuild complete index's from a database 
with 800,000+ entries to new databases that stores the data differently.
My goal is to have 

   - 1 Producer that sends msgs to the queue.
   - A fixed number of consumers to process the messages from the queue.
   - Make new consumers to replace any consumers that prematurely die.
   

I did some research and wanted to use newFixedThreadPool 
<http://docs.oracle.com/javase/1.5.0/docs/api/java/util/concurrent/Executors.html#newFixedThreadPool(int)>from 
the Executers Class but I am not sure how to go about it,
or if it is possible to use with rabbitMQ.

in my experiment so far I start things like so
     
// create the consumers thread pool
ExecutorService execSvc = Executors.newFixedThreadPool(4);

// give the thread pool some consumers
for (int i = 0; i < 4; i++) {

execSvc.execute(new RebuilderConsumer());

}

However when a thread dies no new thread is created.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20120717/e6706d7a/attachment.htm>


More information about the rabbitmq-discuss mailing list