amqplib-rpc
amqplib-rpc copied to clipboard
amqplib callback api fixes
fixes #6 and #16
@lukinsv can you try this branch out and let me if it fixes the problem?
Thanks!
No reply from rpc server, hangs on line
reply = request(conn, 'multiply-queue', message, { timeout: 100 });
in my test script.
Server says
Error: Channel closed by server: 404 (NOT-FOUND) with message "NOT_FOUND - no queue 'multiply-queue' in vhost '/'" at Channel.C.accept (/home/slukin/nodejs/t01s1/node_modules/amqplib/lib/channel.js:406:17)
Set timeout to 5 sec and now I can see almost perfect result. The one thing I am asking you to check is why the 'request' function doesn't call it's callback function 'cb' at the end. Full screen output:
$ DEBUG="amqplib-rpc:request" node client.js amqplib-rpc:request createChannel +0ms amqplib-rpc:request Assert queue and send request a39ceb8d-504b-43cc-83ac-3569c1de2dbd { exclusive: true } +7ms amqplib-rpc:request Add timeout promise +3ms amqplib-rpc:request Assert queue and send request: success a39ceb8d-504b-43cc-83ac-3569c1de2dbd { queue: 'amq.gen-j5plVsXmCWTJgYcMoVZe9w', messageCount: 0, consumerCount: 0 } +2ms amqplib-rpc:request Consume reply queue: a39ceb8d-504b-43cc-83ac-3569c1de2dbd amq.gen-j5plVsXmCWTJgYcMoVZe9w +1ms amqplib-rpc:request Send request message: a39ceb8d-504b-43cc-83ac-3569c1de2dbd multiply-queue <Buffer 7b 22 61 22 3a 35 2c 22 62 22 3a 34 7d> { correlationId: 'a39ceb8d-504b-43cc-83ac-3569c1de2dbd', replyTo: 'amq.gen-j5plVsXmCWTJgYcMoVZe9w' } +1ms amqplib-rpc:request Reply queue received response message: a39ceb8d-504b-43cc-83ac-3569c1de2dbd { fields: { consumerTag: 'amq.ctag-4289IEOE-rdPp8aUrcv4Gw', deliveryTag: 1, redelivered: false, exchange: '', routingKey: 'amq.gen-j5plVsXmCWTJgYcMoVZe9w' }, properties: { contentType: undefined, contentEncoding: undefined, headers: {}, deliveryMode: undefined, priority: undefined, correlationId: 'a39ceb8d-504b-43cc-83ac-3569c1de2dbd', replyTo: undefined, expiration: undefined, messageId: undefined, timestamp: undefined, type: undefined, userId: undefined, appId: undefined, clusterId: undefined }, content: <Buffer 32 30> } +3s amqplib-rpc:request Response success: { fields: { consumerTag: 'amq.ctag-4289IEOE-rdPp8aUrcv4Gw', deliveryTag: 1, redelivered: false, exchange: '', routingKey: 'amq.gen-j5plVsXmCWTJgYcMoVZe9w' }, properties: { contentType: undefined, contentEncoding: undefined, headers: {}, deliveryMode: undefined, priority: undefined, correlationId: 'a39ceb8d-504b-43cc-83ac-3569c1de2dbd', replyTo: undefined, expiration: undefined, messageId: undefined, timestamp: undefined, type: undefined, userId: undefined, appId: undefined, clusterId: undefined }, content: <Buffer 32 30> } +1ms amqplib-rpc:request Success: { fields: { consumerTag: 'amq.ctag-4289IEOE-rdPp8aUrcv4Gw', deliveryTag: 1, redelivered: false, exchange: '', routingKey: 'amq.gen-j5plVsXmCWTJgYcMoVZe9w' }, properties: { contentType: undefined, contentEncoding: undefined, headers: {}, deliveryMode: undefined, priority: undefined, correlationId: 'a39ceb8d-504b-43cc-83ac-3569c1de2dbd', replyTo: undefined, expiration: undefined, messageId: undefined, timestamp: undefined, type: undefined, userId: undefined, appId: undefined, clusterId: undefined }, content: <Buffer 32 30> } +0ms