I am developing a messaging app using RabbitMQ, and Node.JS. I am using amqplib for this purpose. I am new to Node.JS and finding few difficulties in understanding the syntax of amqplib.. For e.g. there is a function for declaring queue, that is
channel.assertQueue([queue, [options, [function(err, ok) {...}]]]);
I have been referring This from last 2-3 days but still I am not clear about these -> err
and ok
. How to use these parameters?
An example would be much much appreciated.
The ampqlib github page has some examples on how to use the library, using either callbacks or promises.
I copied their first example and added some comments to explain what's happening.
Might be worth checking their tutorial examples as well, that follows the official RabbitMQ tutorials.