feat(mq-starter-core): @MqListener idempotent 默认值翻转为 true——去重默认开启
不需要去重的监听器显式 idempotent=false,或 mq.idempotent.enabled=false 全局关; Registry 无 store 时的 WARN 文案同步改为默认开启口径。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -13,8 +13,8 @@ public @interface MqListener {
|
||||
int batchSize() default 1;
|
||||
int maxRetry() default 3;
|
||||
String tag() default "*";
|
||||
/** 是否启用消费去重(按 key)。默认关闭。 */
|
||||
boolean idempotent() default false;
|
||||
/** 是否启用消费去重(按 key)。默认开启,不需要去重时显式置 false。 */
|
||||
boolean idempotent() default true;
|
||||
/** 异常落库回调的 bean 名;空表示不落库。 */
|
||||
String errorHandler() default "";
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ public class MqListenerRegistry implements SmartLifecycle {
|
||||
for (MqListenerEndpoint ep : endpoints) {
|
||||
MqListener meta = ep.getMeta();
|
||||
if (meta.idempotent() && store == null) {
|
||||
log.warn("[mq] @MqListener(idempotent=true) 但容器中无 MqIdempotentStore bean,去重不生效: topic={} group={}",
|
||||
log.warn("[mq] @MqListener 去重已启用(idempotent 默认 true)但容器中无 MqIdempotentStore bean,去重不生效: topic={} group={}",
|
||||
meta.topic(), meta.group());
|
||||
}
|
||||
MqConsumeErrorHandler eh = resolveErrorHandler(meta);
|
||||
|
||||
Reference in New Issue
Block a user