postwait / node-amqp

[UNMAINTAINED] node-amqp is an AMQP client for nodejs
MIT License
1.69k stars 357 forks source link

Reply to a message #404

Open scastrec opened 8 years ago

scastrec commented 8 years ago

I'm working on two servers communicating. First in Spring -> convertSendAndReceive. On NodeJS side, I receive the message and try to respond this way : (http://www.rubydoc.info/github/ruby-amqp/amqp/master/file/docs/PatternsAndUseCases.textile#Request_Reply_pattern)

q.subscribe(function (message, headers, deliveryInfo, messageObject) {
                console.log("received message from rabbit -> " + message);
                if(deliveryInfo.routingKey === route_start){
                    //event started
                    var options = {
                        correlationId : deliveryInfo.correlationId
                    };
                    replyExchange.publish(deliveryInfo.replyTo, message, options, function(error){
                        console.log("debug replyExchange : " + error);
                    });
                }
            });

Do you implement a "better" way to use request/reply on rabbitMQ?