diff --git a/lib/message.js b/lib/message.js index 149105b..f323f3b 100644 --- a/lib/message.js +++ b/lib/message.js @@ -1,3 +1,8 @@ +/** + * `Message` constructor. + * + * @api protected + */ function Message(queue, message, headers, deliveryInfo) { // Crane uses slash ('/') separators rather than period ('.') this.topic = deliveryInfo.routingKey.replace(/\./g, '/'); @@ -6,12 +11,24 @@ function Message(queue, message, headers, deliveryInfo) { // TODO: only set body if it has been parsed, otherwise set `data` this.body = message; - this._amqp = { queue: queue }; + this._q = queue; } +/** + * Acknowledge message. + * + * Examples: + * + * msg.ack(); + * + * @api public + */ Message.prototype.ack = function() { - this._amqp.queue.shift(); + this._q.shift(); } +/** + * Expose `Message`. + */ module.exports = Message;