<div>Rajat,</div><div><br></div><div>about the second example, why more instances should be a problem? Having more subscribers in the same process doesn't have much sense, in my opinion, since the reactor pattern doesn't block -> you don't have to wait -> you don't need to use threads for parallelisation. Threads can be an advantage, but I don't think it'll be a big difference. Plus Ruby has GIL which means threads are sort of useless anyway, well, especially if you use Ruby 1.8 which still has green threads. I'd say if you want to go this route, use Kernel#fork, but then you have to be careful about consistency of state. Breaking logic down sounds like a much better & cleaner way to go in my opinion.</div>
<br clear="all">Jakub<div><div><br></div><div><a href="http://www.flickr.com/photos/jakub-stastny/" target="_blank">http://www.flickr.com/photos/jakub-stastny</a></div></div><div><a href="http://twitter.com/botanicus" target="_blank">http://twitter.com/botanicus</a></div>
<br>
<br><br><div class="gmail_quote">2011/2/23 Rajat Vig <span dir="ltr"><<a href="mailto:rajat.vig@gmail.com">rajat.vig@gmail.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div>Thanks for the suggestions. I'd the same thing in mind about being able to start multiple of those processes.</div><div><br></div><div>There are 2 different kinds of consumers</div><div>1. Get the message and write it to a database or send it out to someplace else.</div>
<div>Parallelizing this would be easy. Controlling would be more of a problem here but manageable. </div><div><br></div><div>2. There's one large consumer which accepts different kinds of messages.</div><div>Like start/stop/abandon a game (which are always singular) and messages for the game itself which are many.</div>
<div>I don't want to run this one many times since it might just run into conflicts (though I can't see many currently - it does impose a rigid discipline in the code).</div><div>The alternative that I'm thinking here is to internally re-route by (generated) random keys and have multiple subscribers in the same process. Would that work fine?</div>
<div>It not, I think breaking it further to a consumer for all admin messages and multiple consumers for the game plays would be the way forward but it'll be a significant refactor.</div><div><br></div><div>-Rajat</div>
<br><div class="gmail_quote">2011/2/22 Jakub Šťastný <span dir="ltr"><<a href="mailto:stastny@101ideas.cz" target="_blank">stastny@101ideas.cz</a>></span><div><div></div><div class="h5"><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Rajat, could you maybe provide some more info? In general I'd agree with Jim, although it depends, there are probably other solutions as well (like more queues -> more granular design of the app with more consumers).<div>
<br clear="all">Jakub<div><div><br></div><div><a href="http://www.flickr.com/photos/jakub-stastny/" target="_blank">http://www.flickr.com/photos/jakub-stastny</a></div></div><div><a href="http://twitter.com/botanicus" target="_blank">http://twitter.com/botanicus</a></div>
<br>
<br><br><div class="gmail_quote"><div><div></div><div>On 22 February 2011 17:43, Rajat Vig <span dir="ltr"><<a href="mailto:rajat.vig@gmail.com" target="_blank">rajat.vig@gmail.com</a>></span> wrote:<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div></div><div>
<div>Hi<br></div><div><br></div><div>We've written an application using the amqp gem with RabbitMQ.</div><div>Currently the bottleneck we've run into is that if there are too many message incoming then processing the queue takes long.</div>
<div>After reading some messages on the list, I think allowing multiple consumers is the way forward.</div><div><br></div><div>How do I do that? And are there any pitfalls/gotchas?</div><div><br></div><font color="#888888"><div>
-Rajat</div>
</font><br></div></div><div>_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br></div></blockquote></div><br></div>
</blockquote></div></div></div><br>
</blockquote></div><br>