The queue.post() method returns message id's to its callback after success. However, the format of the response object is not consistent. If one message was queued, the response object is a string with the message id. If more than one message was successfully queued, it returns an array of string message id's. This forces consuming clients to implement logic to properly access the message id's returned by the post.
For example:
var iron_mq = require('iron_mq');
var queue = new iron_mq.Client([credentials]);
queue.post({foo:bar}, function(err, res) {
var messageIds = res; // will be a string of one message id
});
queue.post([{foo:bar},{baz:biz}], function(err, res) {
var messageIds = res; // will be an array of message ids
});
The queue.post() method returns message id's to its callback after success. However, the format of the response object is not consistent. If one message was queued, the response object is a string with the message id. If more than one message was successfully queued, it returns an array of string message id's. This forces consuming clients to implement logic to properly access the message id's returned by the post.
For example: