Advertisement
vitareinforce

subscriber

Oct 16th, 2023
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. var amqp = require('amqplib/callback_api');
  2.  
  3. amqp.connect('amqp://TMDG2022:TMDG2022@rmq2.pptik.id:5672/', function(error0, connection) {
  4. if (error0) {
  5. throw error0;
  6. }
  7. connection.createChannel(function(error1, channel) {
  8. if (error1) {
  9. throw error1;
  10. }
  11. var queue = 'testing';
  12.  
  13. channel.assertQueue(queue, {
  14. durable: false
  15. });
  16.  
  17. console.log(" [*] Waiting for messages in %s. To exit press CTRL+C", queue);
  18. channel.consume(queue, function(msg) {
  19. console.log(" [x] Received %s", msg.content.toString());
  20. }, {
  21. noAck: true
  22. });
  23. });
  24. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement