I’ve used NSQ for one of our projects - It is very cool system for handling messaging queues. But I had a very annoying problem - We have more than 5 queues and for each I should start new container of nsq_tail:
1version: '3.2'
2services:
3 nsqtail:
4 image: nsqio/nsq
5 command: /nsq_tail --topic=mytopic1 --lookupd-http-address=nsqlookupd:4161
6 nsqtail2:
7 image: nsqio/nsq
8 command: /nsq_tail --topic=mytopic2 --lookupd-http-address=nsqlookupd:4161
9 nsqtail3:
10 image: nsqio/nsq
11 command: /nsq_tail --topic=mytopic3 --lookupd-http-address=nsqlookupd:4161
12...
I know that Docker is “lightweight” system… But not lightweight-enough for running too many containers for simple tasks. So my idea was to make nsq_tail listen for multiple topics at once and write all messages from them. Now I can do simply:
1version: '3.2'
2services:
3 nsqtail:
4 image: soarname/nsq
5 command: /nsq_tail --topic=topic1 --topic=topic2 --topic=topic3 --lookupd-http-address=nsqlookupd:4161
And then in logs I see:
1nsqtail_1 | topic1 | test-message-1
2nsqtail_1 | topic2 | test-message-2
3nsqtail_1 | topic3 | test-message-3
So, if you want use this improvement - just pull my automatically built image from Docker Hub: soarname/nsq or vote for my Pull Request #957.
Update: it has been merged and now available in the upstream repo.