Skip to content

Commit c121615

Browse files
committed
- Added support for /temp-queue
1 parent f68816c commit c121615

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

lib/stomp.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,8 @@ var Stomp = module.exports = function () {
210210
}
211211
}
212212
else {
213-
sendCommand('SUBSCRIBE', headers);
213+
if (headers.destination.indexOf('/temp-queue/') === -1)
214+
sendCommand('SUBSCRIBE', headers);
214215
subscribedTo[destination] = { enabled: true, callback: callback };
215216
log.debug('subscribed to: ' + destination + ' with headers ' + sys.inspect(headers));
216217
}
@@ -497,6 +498,7 @@ var Stomp = module.exports = function () {
497498
*/
498499
var parseHeaders = function (rawHeaders) {
499500
log.debug('rawHeaders', rawHeaders);
501+
500502
var headers = {};
501503
var headersSplit = rawHeaders.split('\n');
502504

@@ -662,8 +664,13 @@ var Stomp = module.exports = function () {
662664
* @returns {Boolean} return *true* if the frame is a message; otherwise, *false*
663665
*/
664666
var shouldRunMessageCallback = function (frame) {
665-
var subscription = subscribedTo[frame.headers.destination];
666-
if (frame.headers.destination !== null && subscription !== null) {
667+
var subscription = null;
668+
if (frame.headers.subscription)
669+
subscription = subscribedTo[frame.headers.subscription];
670+
else
671+
subscription = subscribedTo[frame.headers.destination];
672+
673+
if (frame.headers.destination !== null && subscription !== null && typeof (subscription) !== 'undefined') {
667674
if (subscription.enabled && subscription.callback !== null && typeof(subscription.callback) === 'function') {
668675
subscription.callback(frame.body, frame.headers);
669676
}

0 commit comments

Comments
 (0)