RabbitMQ tutorial - Publish/Subscribe — RabbitMQ
*producer*
is a user application that sends messages.*queue*
is a buffer that stores messages.*consumer*
is a user application that receives messages.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: X
fanout
- broadcasts all the messages it receives to all the queues it knowsch.assertExchange('logs', 'fanout', {durable: false})
<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!'));
channel.assertQueue('', {
exclusive: true
});
channel.bindQueue(q.queue, 'logs', '');