0

I started reading up on RabbitMQ to decide if we could use it for a new web project - and I am pretty excited right now :-)

  1. All the samples I saw use some kind of while(true) loop in a console application as a consumer. What would be a solid and fault tolerant way to implement a consumer on a windows platform. I suppose a windows service? Has anybody done this and has it running in production and can maybe share his experience?

  2. What I want to do is simply put the MQ on one server, pushing the messages in from a web app and use a 2nd server to connect to the MQ on the first server, poll for messages (every second) and execute some actions. Is this possible with RabbitMQ?

Thx Eau

1 Answer 1

1
  1. What's wrong with while (true) processing? As long as you have a mechanism in that loop to gracefully break out of it, it may be all you need. Integrating with the Windows SCM is fine too, you'll just have to watch for SCM events like SERVICE_CONTROL_STOP within your service control handler function and react accordingly.

  2. Yep, perfectly reasonable and very common. That said, there's probably no need to poll every second for new events. Just have your consumer start a thread that polls RabbitMQ indefinitely and processes events once they arrive. Otherwise you'll incur a whole lot of unnecessary polling traffic.

2
  • The consumer should have a while loop that uses QueueingConsumer.Delivery delivery = consumer.nextDelivery(); this way it will get the next message as soon as it arrives with no need for polling.
    – robthewolf
    Commented Jun 13, 2012 at 7:04
  • Ok, that sounds good, thx a bunch, guys! I'll try that and probably come back with some more Rabbit-y questions ;-) Commented Jun 13, 2012 at 12:46

Not the answer you're looking for? Browse other questions tagged or ask your own question.