8000 Change buffer creation approach · zerolugithub/rabbitmq-tutorials@c544f23 · GitHub
[go: up one dir, main page]

10000 Skip to content

Commit c544f23

Browse files
Francisco OrtizFrancisco Ortiz
authored andcommitted
Change buffer creation approach
1 parent 406ef10 commit c544f23

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

javascript-nodejs/src/send.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ var amqp = require('amqplib/callback_api');
55
amqp.connect('amqp://localhost', function(err, conn) {
66
conn.createChannel(function(err, ch) {
77
var q = 'hello';
8+
var buffer = new Buffer('Hello World!');
89

910
ch.assertQueue(q, {durable: false});
10-
ch.sendToQueue(q, new Buffer('Hello World!'));
11-
console.log(" [x] Sent 'Hello World!'");
11+
ch.sendToQueue(q, buffer);
12+
console.log(" [x] Sent %s", buffer.toString());
1213
});
1314
setTimeout(function() { conn.close(); process.exit(0) }, 500);
1415
});

0 commit comments

Comments
 (0)
0