2

I am using github.com/nsqio/go-nsq Go package to work with NSQ, and I've met following problem. When producer writes a message - it creates a topic, but not a channel, and it seems that NSQ server just discards a messages when there are no channels. I don't want to lose messages, also I don't want to rely on consumer and producer startup order. So a possible solution is to create a channel on producer side, so when it writes it will not discard messages. How can I create and destroy a consumer without consuming a message, just for sake of channel creation?

sequence of

nsq.NewConsumer()
consumer.AddConcurrentHandlers()
consumer.ConnectToNSQLookupd()

can consume

removing AddConcurrentHandlers leads to error

From protocol spec I cannot see how is it supposed to do, other that sending SUB followed by CLS, but because those are two commands and non "atomic" kind of op - something theoretically may happen in between..

So probably I am trying to do that wrong? RABBITMQ for example can pre-create it, is here something like that?

rustyx
  • 80,671
  • 25
  • 200
  • 267
xakepp35
  • 2,878
  • 7
  • 26
  • 54

0 Answers0