Skip to content

GH-1477: Reduce Log Noise While Broker Down #1523

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 21, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Executor;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.stream.Collectors;

import org.aopalliance.aop.Advice;
Expand Down Expand Up @@ -147,6 +148,8 @@ public abstract class AbstractMessageListenerContainer extends RabbitAccessor

private ContainerDelegate proxy = this.delegate;

private final AtomicBoolean logDeclarationException = new AtomicBoolean(true);

private long shutdownTimeout = DEFAULT_SHUTDOWN_TIMEOUT;

private ApplicationEventPublisher applicationEventPublisher;
Expand Down Expand Up @@ -1960,12 +1963,18 @@ protected synchronized void redeclareElementsIfNecessary() {
if (!this.lazyLoad && admin != null && isAutoDeclare()) {
try {
attemptDeclarations(admin);
this.logDeclarationException.set(true);
}
catch (Exception e) {
if (RabbitUtils.isMismatchedQueueArgs(e)) {
throw new FatalListenerStartupException("Mismatched queues", e);
}
logger.error("Failed to check/redeclare auto-delete queue(s).", e);
if (this.logDeclarationException.getAndSet(false)) {
this.logger.error("Failed to check/redeclare auto-delete queue(s).", e);
}
else {
this.logger.error("Failed to check/redeclare auto-delete queue(s).");
}
}
}
}
Expand Down