详解rabbitmq 之exchange和routingkey、queue和死亡队列的关系
Exchange
Exchange.DeclareOk exchangeDeclare(String exchange, BuiltinExchangeType type,
boolean durable, boolean autoDelete,Map<String, Object> arguments) throws IOException
exchange:交换机名称
type:交换机类型
durable:是否持久化,持久化后重启rabbitmq不会删除,需要配合autoDelete使用
autoDelete:是否自动删除,当这个true时,上面的不生效,没有连接后,exchange将会被删除
arguments:配置备用的exchange名称。If messages to this exchange cannot otherwise be routed, send them to the alternate exchange named here.(Sets the "alternate-exchange" argument.)
Rabbitmq Exchange Type 说明
Exchange在定义的时候是有类型的,以决定到底是哪些Queue符合条件,可以接收消息
fanout
所有bind到此exchange的queue都可以接收消息,此时exchange会将收到的消息分发到所有与之绑定的queue上面,roukey在此不再生效。