Skip to content

Commit 13972ff

Browse files
committed
Improve active/inactive consumer logging
1 parent fc5e2a8 commit 13972ff

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

pkg/amqp10/consumer.go

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,21 +123,26 @@ func (c *Amqp10Consumer) CreateReceiver(ctx context.Context) {
123123
case <-ctx.Done():
124124
return
125125
default:
126+
linkProperties := buildLinkProperties(c.Config, c.Id)
126127
receiver, err := c.Session.NewReceiver(ctx,
127128
c.Terminus,
128129
&amqp.ReceiverOptions{
129130
SourceDurability: durability,
130131
Credit: int32(c.Config.ConsumerCredits),
131-
Properties: buildLinkProperties(c.Config, c.Id),
132+
Properties: linkProperties,
132133
Filters: buildLinkFilters(c.Config),
133134
RequestedSenderSettleMode: requestedSenderSettleMode(c.Config),
134135
OnLinkStateProperties: func(props map[string]any) {
135136
if active, ok := props["rabbitmq:active"]; ok {
136137
if activeBool, ok := active.(bool); ok {
138+
logArgs := []any{"id", c.Id}
139+
if priority, ok := linkProperties["rabbitmq:priority"]; ok {
140+
logArgs = append(logArgs, "priority", priority)
141+
}
137142
if activeBool {
138-
log.Info("consumer is active", "id", c.Id)
143+
log.Info("consumer is active", logArgs...)
139144
} else {
140-
log.Info("consumer is not active", "id", c.Id)
145+
log.Info("consumer is not active", logArgs...)
141146
}
142147
}
143148
}

0 commit comments

Comments
 (0)