@@ -285,7 +285,8 @@ Stomp.prototype.connect = function() {
285
285
// Takes a `Frame` object
286
286
//
287
287
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' ] ) )
289
290
}
290
291
291
292
// ## Stomp.should_run_message_callback
@@ -295,9 +296,13 @@ Stomp.prototype.is_a_message = function(this_frame) {
295
296
// Takes a `Frame` object
296
297
//
297
298
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' ) {
301
306
subscription . callback ( this_frame . body , this_frame . headers ) ;
302
307
}
303
308
}
@@ -401,6 +406,18 @@ Stomp.prototype.ack = function(message_id) {
401
406
} ;
402
407
403
408
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
+
404
421
//
405
422
// ## Stomp.nack(message_id)
406
423
//
0 commit comments