Wabbit
Simplify working with RabbitMQ - built on top of Rabbot
Dependencies
Usage
npm install --save wabbit
- Use this on the server only!
Configuration
Configure Wabbit
with the config vars that you would pass to Rabbot
when configuring that service.
see Rabbot README for config options
const Wabbit = // Wabbit.nackOnError()// Wabbit.debug = true Wabbit // only if a dead-letter exchange is definedWabbitrejectOnError = true // only if a dead-letter exchange is definedWabbitreplyWithBody = trueWabbit
Properties
debug (boolean) This option, when true, will console.log a bunch of information as Wabbit is carrying out its operations.
rejectOnError (boolean)
This option, when true, will reject
a message if there is an error. This should only be used when there is a dead-letter exchange defined.
replyWithBody (boolean)
This option, when true, will send back the reply.body
instead of the full reply
object from Wabbit.request
.
Methods (server)
You can set up your message handlers like this:
const Wabbit = ex = 'data-source-ex.1' readQueue = name: 'read-queue.1' keys: 'read-from-data-source' readQueue ex
Then you send messages to it like this:
Wabbit
... or, if you do not need to know when the action has been completed...
Wabbit