Skip to content

Commit

Permalink
STOMP consumer Stop() loggging
Browse files Browse the repository at this point in the history
  • Loading branch information
mkuratczyk committed Sep 3, 2024
1 parent bc5f0d0 commit 0d8ef5d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions pkg/stomp_client/consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,19 @@ func (c *StompConsumer) Start(ctx context.Context, subscribed chan bool) {
}

func (c *StompConsumer) Stop(reason string) {
log.Debug("closing connection", "id", c.Id, "reason", reason)
if c.Subscription != nil {
_ = c.Subscription.Unsubscribe()
err := c.Subscription.Unsubscribe()
if err != nil {
log.Info("failed to unsubscribe", "id", c.Id, "error", err.Error())
}
}
if c.Connection != nil {
_ = c.Connection.Disconnect()
err := c.Connection.Disconnect()
if err != nil {
log.Info("failed to disconnect", "id", c.Id, "error", err.Error())
}
}
log.Debug("consumer stopped", "id", c.Id)
}

func buildSubscribeOpts(cfg config.Config) []func(*frame.Frame) error {
Expand Down

0 comments on commit 0d8ef5d

Please sign in to comment.