chore(queue): Add NSQ Parameter.

Signed-off-by: Bo-Yi Wu <appleboy.tw@gmail.com>
This commit is contained in:
Bo-Yi Wu 2021-07-24 23:01:31 +08:00
parent 7b16a4db98
commit 0b0f47e4f9
1 changed files with 4 additions and 0 deletions

View File

@ -331,6 +331,10 @@ func main() {
)
case core.NSQ:
w = nsq.NewWorker(
nsq.WithAddr(cfg.Queue.NSQ.Addr),
nsq.WithTopic(cfg.Queue.NSQ.Topic),
nsq.WithChannel(cfg.Queue.NSQ.Channel),
nsq.WithMaxInFlight(int(cfg.Core.WorkerNum)),
nsq.WithRunFunc(func(msg *n.Message) error {
if len(msg.Body) == 0 {
// Returning nil will automatically send a FIN command to NSQ to mark the message as processed.