style(driver): 两 driver 运行期日志与异常文案中文化

纯文案改动,无逻辑变化;关键消费路径日志(毒消息 ACK/InProgress 留投/重试耗尽)
统一为中文口径,便于业务侧排查。

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-14 13:04:28 +01:00
parent ec5b22b392
commit cfe9d0e994
2 changed files with 11 additions and 11 deletions

View File

@@ -54,7 +54,7 @@ public class RocketMqDriver implements MqDriver {
consumer.start();
consumers.add(consumer);
} catch (Exception e) {
throw new IllegalStateException("rocket subscribe failed: " + sub.getTopic(), e);
throw new IllegalStateException("RocketMQ 订阅失败 topic=" + sub.getTopic(), e);
}
}
@@ -67,7 +67,7 @@ public class RocketMqDriver implements MqDriver {
} catch (MqMessageInProgressException inProgress) {
// 去重"处理中"信号:不 ACK,交 broker 重投;绝不进耗尽落库分支(否则并发下静默丢消息)。
// 语义对齐 RedisStreamMqDriver#dispatch 对该异常的 return false(留 PEL)。
log.debug("[mq-rocket] in-progress, reconsume later key={}", ext.getKeys());
log.debug("[mq-rocket] 消息仍在处理中,返回 RECONSUME_LATER 待重投 key={}", ext.getKeys());
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
} catch (Exception e) {
if (ext.getReconsumeTimes() >= maxRetry) {
@@ -75,7 +75,7 @@ public class RocketMqDriver implements MqDriver {
//(对齐 redis-stream reclaim 耗尽语义,兑现"换 MQ 业务不动"契约)。
onRetryExhausted(sub, ext, e);
} else {
log.warn("[mq-rocket] handle failed msgId={} reconsume={}", ext.getMsgId(), ext.getReconsumeTimes(), e);
log.warn("[mq-rocket] 消费失败,交 broker 重投 msgId={} reconsume={}", ext.getMsgId(), ext.getReconsumeTimes(), e);
return ConsumeConcurrentlyStatus.RECONSUME_LATER;
}
}
@@ -85,7 +85,7 @@ public class RocketMqDriver implements MqDriver {
/** 重试耗尽落库(best-effort:毒消息时 payload 为 null至少保留 key/tag),并隔离 handler 自身异常。 */
private void onRetryExhausted(MqSubscription sub, MessageExt ext, Exception cause) {
log.warn("[mq-rocket] retry exhausted, acked msgId={} reconsume={}", ext.getMsgId(), ext.getReconsumeTimes(), cause);
log.warn("[mq-rocket] 重试耗尽,已 ACK 终止 msgId={} reconsume={}", ext.getMsgId(), ext.getReconsumeTimes(), cause);
Consumer<MqMessage> handler = sub.getRetryExhaustedHandler();
if (handler == null) return;
Object payload = null;
@@ -97,7 +97,7 @@ public class RocketMqDriver implements MqDriver {
try {
handler.accept(MqMessage.of(ext.getKeys(), ext.getTags(), payload));
} catch (Exception ex) {
log.error("[mq-rocket] retryExhausted handler error msgId={}(不影响主流程)", ext.getMsgId(), ex);
log.error("[mq-rocket] 重试耗尽落库回调执行异常 msgId={}(不影响主流程", ext.getMsgId(), ex);
}
}