triton develop document
本小节主要介绍如何使用triton快速完成nsq消息的消费,在此不再对nsq做相关的介绍,不了解nsq的可以去nsq官网阅读相关文档。
./bin/nsqlookupd
./bin/nsqd --lookupd-tcp-address=127.0.0.1:4160
{
"enabled": {
"nsq": true
},
"nsq": [
{
"consumerCount": 2,
"nsqLookup": [
"127.0.0.1:4161"
],
"topic": "test",
"channel": "nsq",
"tplMode": 1
}
]
}
[test]
-=
-=@NONE
这个模板其实对应的是tpl/init.go中funcMap中的printf逻辑,将消费到的消息进行打印。
- 如果tplMode为1,[test]指的就是消费topic为test中的消息,然后执行printf方法
- 如果tplMode为0,[test]指的就是消费topic为test中tag为test的消息,然后执行printf方法
make
./bin/triton -c ../conf/conf.ini