Skip to content

Commit

Permalink
Explicitly close sender/received
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuratczyk committed Jan 17, 2025
1 parent 3b5f05d commit 4622b44
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
3 changes: 3 additions & 0 deletions pkg/amqp10/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,9 @@ func pastTense(outcome string) string {
}

func (c *Amqp10Consumer) Stop(reason string) {
if c.Receiver != nil {
_ = c.Receiver.Close(context.Background())
}
if c.Session != nil {
_ = c.Session.Close(context.Background())
}
Expand Down
3 changes: 3 additions & 0 deletions pkg/amqp10/publisher.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ func (p *Amqp10Publisher) handleSent(receipt *amqp.SendReceipt, published time.T
func (p *Amqp10Publisher) Stop(reason string) {
p.poolWg.Wait()
log.Debug("closing publisher connection", "id", p.Id, "reason", reason)
if p.Sender != nil {
_ = p.Sender.Close(context.Background())
}
if p.Session != nil {
_ = p.Session.Close(context.Background())
}
Expand Down

0 comments on commit 4622b44

Please sign in to comment.