I am using node.js amqp module for reading messages from a queue. The following is the callback that is invoked when there is a message available on the queue:
function onMessage(message, headers, deliveryInfo)
{
console.log(message); //This prints buffer
//how to convert message (which I expect to be JSON) into a JSON object.
//Also how to get the JSON string from the 'message' which seems to be a buffer
}
Thanks.
message.data.toString() returned the appropriate JSON string.