Skip to content

Commit

Permalink
fix queue to exit when mq processing msg panic
Browse files Browse the repository at this point in the history
  • Loading branch information
桂千山 committed Jan 26, 2024
1 parent 757efd5 commit b67726d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions pkg/client/rocketmq/push_consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,7 @@ func (cc *PushConsumer) RegisterSingleMessage(f func(context.Context, *primitive
}
}

err := f(ctx, msg)
if err != nil {
if err := f(ctx, msg); err != nil {
xlog.Jupiter().Error("consumer message", zap.Error(err), zap.String("field", cc.name), zap.Any("ext", msg))
if cc.EnableTrace && span != nil {
span.RecordError(err)
Expand Down Expand Up @@ -201,8 +200,7 @@ func (cc *PushConsumer) RegisterBatchMessage(f func(context.Context, ...*primiti
}
}

err := f(ctx, msgs...)
if err != nil {
if err := f(ctx, msgs...); err != nil {
xlog.Jupiter().Error("consumer batch message", zap.Error(err), zap.String("field", cc.name))
return consumer.ConsumeRetryLater, err
}
Expand Down

0 comments on commit b67726d

Please sign in to comment.