Skip to content
This repository was archived by the owner on Nov 28, 2018. It is now read-only.

Commit d8c04c9

Browse files
author
victor73
committed
Fixed conflict and some formatting of PR.
2 parents d75ef72 + d8d7527 commit d8c04c9

File tree

1 file changed

+21
-4
lines changed

1 file changed

+21
-4
lines changed

lib/stomp.js

+21-4
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ Stomp.prototype.connect = function() {
285285
// Takes a `Frame` object
286286
//
287287
Stomp.prototype.is_a_message = function(this_frame) {
288-
return (this_frame.headers !== null && utils.really_defined(this_frame.headers['message-id']))
288+
return (this_frame.headers !== null &&
289+
utils.really_defined(this_frame.headers['message-id']))
289290
}
290291

291292
// ## Stomp.should_run_message_callback
@@ -295,9 +296,13 @@ Stomp.prototype.is_a_message = function(this_frame) {
295296
// Takes a `Frame` object
296297
//
297298
Stomp.prototype.should_run_message_callback = function(this_frame) {
298-
var subscription = this._subscribed_to[this_frame.headers.destination];
299-
if (this_frame.headers.destination !== null && subscription) {
300-
if (subscription.enabled && subscription.callback !== null && typeof(subscription.callback) == 'function') {
299+
// The matching subscribed queue will be found in the subscription headers
300+
// in the case of a reply-to temp queue with rabbitmq
301+
var subscription = this._subscribed_to[this_frame.headers.destination] ||
302+
this._subscribed_to[this_frame.headers.subscription];
303+
if (this_frame.headers.destination !== null && subscription !== null) {
304+
if (subscription.enabled && subscription.callback !== null &&
305+
typeof subscription.callback === 'function') {
301306
subscription.callback(this_frame.body, this_frame.headers);
302307
}
303308
}
@@ -401,6 +406,18 @@ Stomp.prototype.ack = function(message_id) {
401406
};
402407

403408

409+
//
410+
// ## Stomp.nack(message_id)
411+
//
412+
// **Deny received message**
413+
//
414+
// Takes a string representing the message id to nack
415+
//
416+
Stomp.prototype.nack = function(message_id) {
417+
send_command(this, 'NACK', {'message-id': message_id});
418+
this.log.debug('denied message: ' + message_id);
419+
};
420+
404421
//
405422
// ## Stomp.nack(message_id)
406423
//

0 commit comments

Comments
 (0)