RabbitMQ tutorial - Publish/Subscribe — RabbitMQ

The core idea in the messaging model in RabbitMQ is that the producer never sends any messages directly to a queue. Actually, quite often the producer doesn't even know if a message will be delivered to any queue at all.

exchange type:

exchange type: X

ch.assertExchange('logs', 'fanout', {durable: false})

Default (or nameless) exchange

<aside> 💡 sendToQueue( exchangeName, queueName, message ) messages are routed to the queue with the name specified as first parameter, if it exists.

</aside>

channel.publish('logs', '', Buffer.from('Hello World!'));

Exclusive Queue

channel.assertQueue('', {
  exclusive: true
});

Bindings

channel.bindQueue(q.queue, 'logs', '');

Summary