triton develop document
本小节主要介绍如何使用triton快速完成kafka消息的消费,在此不再对kafka做相关的介绍,不太了解kafka的可以去kafka官网阅读相关文档。
./bin/zookeeper-server-start /usr/local/etc/kafka/zookeeper.properties
./bin/kafka-server-start /usr/local/etc/kafka/server.properties
./bin/kafka-topics --create --bootstrap-server localhost:9092 --replication-factor 1 --partitions 1 --topic test
{
"enabled": {
"kafka": true
},
"kafka": [
{
"consumerGroup": "test0",
"consumerCount": 1,
"host": [
"127.0.0.1:9092"
],
"sasl": {
"enabled": false,
"user": "",
"password": ""
},
"topic": "test",
"failTopic": "xes_exercise_fail",
"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