关于RabbitMQ 的默认交换机 的问题

                                       关于RabbitMQ 的默认交换机 的问题

 

有4个默认的交换机

 

 

Name

Default pre-declared names
Direct exchange(Empty string) and amq.direct
Fanout exchangeamq.fanout
Topic exchangeamq.topic
Headers exchangeamq.match (and amq.headers in RabbitMQ)

 

 

Default Exchange

The default exchange is a direct exchange with no name (empty string) pre-declared by the broker.

It has one special property that makes it very useful for simple applications: every queue that is created is automatically bound to it with a routing key which is the same as the queue name.

他有一个特殊的特性对简单应用很有用:每个队列会自动将一个和队列名一致的 Routing  Key 绑定到默认交换机上。

    channel.basicPublish( "", "test_fuzai_queue_1",
            MessageProperties.BASIC,
            message.getBytes());

这个代码的意思是 其实就是将 消息发送到  这个test_fuzai_queue_1队列上

但是其实第二个蚕食其实是 routingKey

For example, when you declare a queue with the name of "search-indexing-online", the AMQP 0-9-1 broker will bind it to the default exchange using "search-indexing-online" as the routing key (in this context sometimes referred to as the binding key). Therefore, a message published to the default exchange with the routing key "search-indexing-online" will be routed to the queue "search-indexing-online". In other words, the default exchange makes it seem like it is possible to deliver messages directly to queues, even though that is not technically what is happening.

 

 

要说的是没默认队列,有默认交换机,理论上每个队列能和这个默认交换机绑定,所以说没有交换机也能发送到队列

 

 

 

参考

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

wangxiaoming

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值