1、exchange [topic]
1)direct 提前預知性的binding info、error、debug、warnning=》exchange
2)fanout **性的binding
3)headers and、or性質的binding x-match
4)topic 歸類性的binding【帶有正則效果】
queue1 *.com
queue2 *.cn
queue3 *.net
符號:*:匹配乙個或多個詞
#:匹配乙個詞
2、**實現
1)生產者
//基礎配置生產者產生的routing會根據消費者佇列繫結的routingkey對應關係去進入不同的佇列connectionfactory factory = new connectionfactory()
;//第一步:建立connection
using (var connection = factory.createconnection())
:", i, "你好"));
var routingkey = i % 13 == 0 ? "呵呵.com" : "哈哈.cn";
channel.basicpublish("mytopicexchange", routingkey, null, body: msg);
console.writeline(i);}}
}console.writeline("生產成功!");
console.readkey();
2)消費者
i)
//建立連線工廠ii)connectionfactory factory = new connectionfactory
;//第一步:建立connection
using (var connection = factory.createconnection())
;//消費
channel.basicconsume("mytopicqueue1", true, consumer);
console.readkey();}}
//建立連線工廠iii)效果圖connectionfactory factory = new connectionfactory
;//第一步:建立connection
using (var connection = factory.createconnection())
;//消費
channel.basicconsume("mytopicqueue2", true, consumer);
console.readkey();}}
3、圖形解釋
因此**進行了調整,示意圖還是有點問題,自己理解下。
徹底刪除Kafka中的topic
1 刪除kafka儲存目錄 server.properties檔案log.dirs配置,預設為 tmp kafka logs 相關topic目錄 2 kafka 刪除topic的命令是 bin kafka topics delete zookeeper zookeeper server topic ...
徹底刪除Kafka中的topic
1 刪除kafka儲存目錄 server.properties檔案log.dirs配置,預設為 tmp kafka logs 相關topic目錄 2 kafka 刪除topic的命令是 bin kafka topics delete zookeeper zookeeper server topic ...
徹底刪除Kafka中的topic
徹底刪除kafka中的topic 1 刪除kafka儲存目錄 server.properties檔案log.dirs配置,預設為 tmp kafka logs 相關topic目錄 2 kafka 刪除topic的命令是 bin kafka topics delete zookeeper zookee...