Overview - messagebus/lapine GitHub Wiki
Lapine uses the bunny gem to publish messages to RabbitMQ, and it uses the amqp gem to consume messages. These two steps are decoupled, and use the different gems because of their different contexts.
Why use Bunny for publishing?
When publishing messages, an application does not need to consider event loops or threads. Bunny has a nicely simple API for publishing messages synchronously, and can be easily configured and run inside of other existing daemons such as unicorn
or sidekiq
.
Why use AMQP for consuming?
The Lapine consumer daemon is small and responsible for two things: receiving messages from RabbitMQ and dispatching them to custom classes. It requires an event loop, for which we use EventMachine. The AMQP gem already wraps all of this up along with nice abstractions for binding queues to exchanges.
Can I use [X] to [publish/consume] messages
Yes.
Use whatever you like. The nice thing about using a message broker to asynchronous communication is that the different parts are decoupled. Use nodejs to write your own consumers. Publish messages from Java processes. You can do whatever you need to do.
The only constraint is that Lapine publishers expect to convert a hash of data into a JSON payload. Lapine consumers should expect to receive a JSON payload and convert it into a hash.