Skip to content

Commit

Permalink
Changing AutoAck -> AutoAckDisabled
Browse files Browse the repository at this point in the history
Signed-off-by: shivam <[email protected]>
  • Loading branch information
shivamkm07 committed Oct 14, 2022
1 parent 5c775c2 commit 35f45ad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions options.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ type ClientOptions struct {
MaxResumePubInFlight int // // 0 = no limit; otherwise this is the maximum simultaneous messages sent while resuming
Dialer *net.Dialer
CustomOpenConnectionFn OpenConnectionFunc
AutoAck bool
AutoAckDisabled bool
}

// NewClientOptions will create a new ClientClientOptions type with some
Expand Down Expand Up @@ -148,7 +148,7 @@ func NewClientOptions() *ClientOptions {
WebsocketOptions: &WebsocketOptions{},
Dialer: &net.Dialer{Timeout: 30 * time.Second},
CustomOpenConnectionFn: nil,
AutoAck: true,
AutoAckDisabled: false,
}
return o
}
Expand Down Expand Up @@ -449,9 +449,9 @@ func (o *ClientOptions) SetCustomOpenConnectionFn(customOpenConnectionFn OpenCon
return o
}

// SetAutoAck enables or disables the Automated Acking of Messages received by the handler.
// By default it is set to true. Setting it to false will disable the auto-ack globally.
func (o *ClientOptions) SetAutoAck(autoAck bool) *ClientOptions {
o.AutoAck = autoAck
// SetAutoAckDisabled enables or disables the Automated Acking of Messages received by the handler.
// By default it is set to false. Setting it to true will disable the auto-ack globally.
func (o *ClientOptions) SetAutoAckDisabled(autoAckDisabled bool) *ClientOptions {
o.AutoAckDisabled = autoAckDisabled
return o
}
6 changes: 3 additions & 3 deletions router.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func (r *router) matchAndDispatch(messages <-chan *packets.PublishPacket, order
wg.Add(1)
go func() {
hd(client, m)
if client.options.AutoAck {
if client.options.AutoAckDisabled {
m.Ack()
}
wg.Done()
Expand All @@ -203,7 +203,7 @@ func (r *router) matchAndDispatch(messages <-chan *packets.PublishPacket, order
wg.Add(1)
go func() {
r.defaultHandler(client, m)
if client.options.AutoAck {
if client.options.AutoAckDisabled {
m.Ack()
}
wg.Done()
Expand All @@ -216,7 +216,7 @@ func (r *router) matchAndDispatch(messages <-chan *packets.PublishPacket, order
r.RUnlock()
for _, handler := range handlers {
handler(client, m)
if client.options.AutoAck {
if client.options.AutoAckDisabled {
m.Ack()
}
}
Expand Down

0 comments on commit 35f45ad

Please sign in to comment.