Installing the RabbitMQ server environment under Windows
RabbitMQ Exchange Mode-Direct
RabbitMQ Exchange Mode-fanout
RabbitMQ Exchange Mode-topic
Any messages sent to Fanout Exchange will be forwarded to all the queue with that Exchange binding (binding).
1. This mode requires early binding of exchange to queue, one exchange can bind multiple queues, and one queue can bind to multiple Exchange
2. This mode does not require Routekey
3. If exchange that receives the message is not bound to any queue, the message is discarded.
Reference code:
Call Execution Code:
View the results of the execution:
View Exchange (already bound to Fanout.1, fanout.2, and fanout.3):
After binding, sending messages to Fanout.1, Fanout.2, fanout.3, and any one queue will be broadcast to the three (Fanout.1, fanout.2, fanout.3) queues at the same time
For example, the following code sends a message to Fanout.1, but Fanout.2 and Fanout.3 are also broadcast to a total of 2 messages:
Test code, click Download