[rabbitmq-discuss] AMQP, Bunny and Carrot Gems

Michael Klishin michael.s.klishin at gmail.com
Mon Jan 23 22:22:43 GMT 2012


Mark:

> Thanks for the insight. From the gist of it it sounds like there really isn't a good reason to use any of those other gems.
> 

In my opinion, yes, but I can see why dealing with EventMachine in a separate thread + reconnection on Unicorn and Passenger may be an annoyance for developers.

> As for your example can't you skip the asynchronous "complexity" by simply using a block?
> 
> channel.queue("", :auto_delete => true, :exclusive => true) do |queue, declare_ok|
>    puts "Broker generated name: #{queue.name}"
>    queue.bind(exchange).subscribe(&method(:handle_reply))
> end
> 
> Thanks

Using blocks is the recommended way to go. However, many developers don't like
it for "the callback soup". It may require a certain mental shift, too. Purely from the familiarity
perspective, my original snippet looks "simpler" and relatively attractive to newcomers. That's one of the reasons why
we had to do extra work to make it work in 0.8.0+ (primary reason is backwards compatibility) and add
this documentation section to the Getting Started guide:

http://rubyamqp.info/articles/getting_started/#integration_with_objects

I like the middle road Java client and Hot Bunnies [1] take: they are synchronous/blocking for operations used when applications
boot (like queue.declare) but asynchronous for operations used further in application lifecycle (basic.publish, basic.consume and so on). In part for that reason I recommend Hot Bunnies to people who can use JRuby.

1. https://github.com/ruby-amqp/hot_bunnies

MK

http://github.com/michaelklishin
http://twitter.com/michaelklishin



More information about the rabbitmq-discuss mailing list