Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

post method returns multiple types based on number of messages queued #51

Open
paulcullin opened this issue May 12, 2015 · 0 comments
Open

Comments

@paulcullin
Copy link

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
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant