过去几周我一直在学习 RabbitMQ。我正在尝试使用“标头”交换来设置决策树类型路由。如果匹配的话我知道如何将其分支出来。但我想要一个“捕获所有”队列,仅当标头与树中的其他任何内容都不匹配时才发送到该队列。
所以
Exchange1 -> if header.value1 = "company1" then goto queue "company1"
-> if header.value1 = "company2" then goto queue "company2"
-> if header.value1 didn't match anyone else then goto queue "catch all"
Run Code Online (Sandbox Code Playgroud)
前两个我很容易弄清楚。但我不知道如何做“不”或“没有找到匹配”。
如果只是设置“捕获所有”而没有任何与之关联的规则,则所有消息都会发送到那里,包括在其他规则下找到匹配项的消息。