Commit 1aeaaaf2 authored by Kamron Aroonrua's avatar Kamron Aroonrua 💬

buff from

parent 6bdeb8aa
...@@ -40,7 +40,7 @@ EventPub.prototype.send = function(topic,msg) ...@@ -40,7 +40,7 @@ EventPub.prototype.send = function(topic,msg)
{ {
var self=this; var self=this;
this.open(function(err){ this.open(function(err){
self.ch.publish(self.name, topic, new Buffer(JSON.stringify(msg))); self.ch.publish(self.name, topic, Buffer.from(JSON.stringify(msg)));
}); });
} }
......
...@@ -41,7 +41,7 @@ QueueCaller.prototype.send = function(msg) ...@@ -41,7 +41,7 @@ QueueCaller.prototype.send = function(msg)
if(err){ if(err){
console.log(err); console.log(err);
} }
self.ch.sendToQueue(self.name, new Buffer(JSON.stringify(msg)), {persistent: true}); self.ch.sendToQueue(self.name, Buffer.from(JSON.stringify(msg)), {persistent: true});
}); });
} }
......
...@@ -51,7 +51,7 @@ RPCCaller.prototype.call = function(req,cb){ ...@@ -51,7 +51,7 @@ RPCCaller.prototype.call = function(req,cb){
self.ch.responseEmitter.once(corr, (resp)=>{ self.ch.responseEmitter.once(corr, (resp)=>{
cb(null,resp); cb(null,resp);
}); });
self.ch.sendToQueue(self.name, new Buffer(JSON.stringify(req)), { correlationId: corr, replyTo: REPLY_QUEUE,persistent: false }) self.ch.sendToQueue(self.name, Buffer.from(JSON.stringify(req)), { correlationId: corr, replyTo: REPLY_QUEUE,persistent: false })
}); });
function generateUuid() { function generateUuid() {
......
...@@ -30,7 +30,7 @@ RPCServer.prototype.start = function(cb) ...@@ -30,7 +30,7 @@ RPCServer.prototype.start = function(cb)
var req = JSON.parse(msg.content.toString()); var req = JSON.parse(msg.content.toString());
self.remote_function(req,function(err,resp){ self.remote_function(req,function(err,resp){
ch.sendToQueue(msg.properties.replyTo,new Buffer(JSON.stringify(resp)),{correlationId: msg.properties.correlationId,persistent: false}); ch.sendToQueue(msg.properties.replyTo,Buffer.from(JSON.stringify(resp)),{correlationId: msg.properties.correlationId,persistent: false});
}); });
//ch.ack(msg); //ch.ack(msg);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment