Shared queue distribution of messages

This commit is contained in:
Asim
2015-12-23 20:05:47 +00:00
parent 536216fd01
commit 6097c3296c
2 changed files with 55 additions and 9 deletions

View File

@@ -9,6 +9,10 @@ type SubscribeOptions struct {
AutoAck bool
// NumHandlers defaults to 1
NumHandlers int
// Subscribers with the same queue name
// will create a shared subscription where each
// receives a subset of messages.
Queue string
}
type Option func(*Options)
@@ -33,6 +37,12 @@ func NumHandlers(i int) SubscribeOption {
}
}
func QueueName(name string) SubscribeOption {
return func(o *SubscribeOptions) {
o.Queue = name
}
}
func newSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
opt := SubscribeOptions{
AutoAck: true,