在线观看不卡亚洲电影_亚洲妓女99综合网_91青青青亚洲娱乐在线观看_日韩无码高清综合久久

鍍金池/ 問答/C  網(wǎng)絡安全/ 如何只訂閱 nsq 某個 topic下的特定channel?

如何只訂閱 nsq 某個 topic下的特定channel?

本地環(huán)境:
testtopic下 有 兩個channel: testchannel1, testchannel2,通過nsq_to_http的方式把數(shù)據(jù)消費到http接口上
e.g:
消費者1:
/usr/local/opt/nsq/bin/nsq_to_http --topic=testtopic --channel=testchannel1 --lookupd-http-address=127.0.0.1:4161 --post=http://xx.xx.xx/index.php?typ... --content-type=application/x-www-form-urlencoded
消費者2:
/usr/local/opt/nsq/bin/nsq_to_http --topic=testtopic --channel=testchannel2 --lookupd-http-address=127.0.0.1:4161 --post=http://xx.xx.xx/index.php?typ... --content-type=application/x-www-form-urlencoded

測試執(zhí)行:
curl -d "hello=world&a=1" 'http://127.0.0.1:4151/pub topic=testtopic&channel=testchannel1'

結(jié)果:
http://xx.xx.xx/index.php 中 可以接收到 type=consumer2 的請求

問題:
我不管往哪個channel下push數(shù)據(jù), 我的兩個消費者都會同事接收到數(shù)據(jù)。 那我的業(yè)務邏輯就亂套了。我不明白nsq 多個channel 到底是怎么用的? 我知道應該是我使用的問題,所以請各位指導一下 如何 只消費特定 channel下的數(shù)據(jù)?

回答
編輯回答
舊螢火

思維走入誤區(qū)

2017年2月6日 13:59