Created
August 24, 2018 18:58
-
-
Save derekcollison/418cc1a25c63991fc551bcf068ef6632 to your computer and use it in GitHub Desktop.
Simple Queue Subscriber
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// All subscriptions with the same queue name will form a queue | |
// group at runtime. Each message will be delivered to only one | |
// subscriber per queue group. You can have as many queue groups | |
// as you wish, and as many members in a single group as you like. | |
// Normal subscribers will continue to work as expected. | |
nc.QueueSubscribe("foo", "job_workers", func(m *Msg) { | |
// Do some work, then send reply. | |
nc.Publish(m.ReplyTo, myAnswer) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment