10000 check correlationId · sardesh/rabbitmq-tutorials@4078b32 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4078b32

Browse files
committed
check correlationId
1 parent 1f64bb0 commit 4078b32

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

javascript-nodejs/src/rpc_client.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ amqp.connect('amqp://localhost', function(err, conn) {
1919
console.log(' [x] Requesting fib(%d)', num);
2020

2121
ch.consume(q.queue, function(msg) {
22-
console.log(' [.] Got %s', msg.content.toString());
23-
setTimeout(function() { conn.close(); process.exit(0) }, 500);
22+
if (msg.properties.correlationId == corr) {
23+
console.log(' [.] Got %s', msg.content.toString());
24+
setTimeout(function() { conn.close(); process.exit(0) }, 500);
25+
}
2426
}, {noAck: true});
2527

2628
ch.sendToQueue('rpc_queue',

0 commit comments

Comments
 (0)
0