I am trying to use amqplib a AMQP 0-9-1 library and client for Node.JS
and I have a question about buffers. How can I write a JSON object to them.
The channel.publish requires content
in the form of a buffer.
And after I publish the message, when I consume them in the worker, how can I extract the message again from the buffer to get the JavaScript object back.
The message
object passed to the consumer is of the form
{
content: Buffer,
fields: Object,
properties: Object
}
where content
is the content we passed to the publisher
JSON.parse(message.content)
Should work