Jackrabbit API

 

It’s tough to get started using RabbitMQ in Node.js. Almost every npm package exposed me to RabbitMQ’s raw complexity that seemed to know no bounds. Thankfully I was smart enough to realize I wasn’t smart enough to try using the powerful libraries. I needed something simpler.

Eventually found Jackrabbit, which markets itself as “RabbitMQ in Node.js without hating life“.

Jackrabbit hides RabbitMQ’s complexity behind a very beginner-friendly API, so it was an obvious choice to get started with. Today, I’m still happily using it 🙂

While I haven’t outgrown Jackrabbit yet, my needs are slightly more mature. Would love to hook into its event emitter so I can get some insight from (or just log) what Jackrabbit is doing.

Unfortunately there’s no public documentation of Jackrabbit’s API, so I’m writing this blog post to document my notes and serve as a starting point for other beginners.

Jackrabbit API

Sections
– Jackrabbit (main export)

Jackrabbit (main export)

The package’s main export is Jackrabbit, a function that takes a url of a RabbitMQ server and returns a modified event emitter.

In addition to emitting events to match the lifecycle of the server connection ( connected , closed  and error ), the event emitter also has helper functions for creating RabbitMQ exchanges, closing the server connection or accessing the underlying amqplib instance doing the heavy lifting.

Details
type: function
args: string_rabbitmq_server_url
return: instanceof EventEmitter (aka “connection event emitter”)

( will be updating this post as I document the API )