Screw num handlers, this adds complexity for concurrency which we dont need
This commit is contained in:
parent
6097c3296c
commit
5e1a618415
@ -5,10 +5,9 @@ type Options struct{}
|
|||||||
type PublishOptions struct{}
|
type PublishOptions struct{}
|
||||||
|
|
||||||
type SubscribeOptions struct {
|
type SubscribeOptions struct {
|
||||||
// AutoAck defaults to true
|
// AutoAck defaults to true. When a handler returns
|
||||||
|
// with a nil error the message is acked.
|
||||||
AutoAck bool
|
AutoAck bool
|
||||||
// NumHandlers defaults to 1
|
|
||||||
NumHandlers int
|
|
||||||
// Subscribers with the same queue name
|
// Subscribers with the same queue name
|
||||||
// will create a shared subscription where each
|
// will create a shared subscription where each
|
||||||
// receives a subset of messages.
|
// receives a subset of messages.
|
||||||
@ -29,14 +28,7 @@ func DisableAutoAck() SubscribeOption {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// NumHandlers sets the number of concurrent handlers to create
|
// QueueName sets the name of the queue to share messages on
|
||||||
// for a subscriber.
|
|
||||||
func NumHandlers(i int) SubscribeOption {
|
|
||||||
return func(o *SubscribeOptions) {
|
|
||||||
o.NumHandlers = i
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
func QueueName(name string) SubscribeOption {
|
func QueueName(name string) SubscribeOption {
|
||||||
return func(o *SubscribeOptions) {
|
return func(o *SubscribeOptions) {
|
||||||
o.Queue = name
|
o.Queue = name
|
||||||
@ -46,7 +38,6 @@ func QueueName(name string) SubscribeOption {
|
|||||||
func newSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
|
func newSubscribeOptions(opts ...SubscribeOption) SubscribeOptions {
|
||||||
opt := SubscribeOptions{
|
opt := SubscribeOptions{
|
||||||
AutoAck: true,
|
AutoAck: true,
|
||||||
NumHandlers: 1,
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
|
Loading…
Reference in New Issue
Block a user