Log broker availability events as String messages

Prior to this commit, AbstractBrokerMessageHandler logged the
BrokerAvailabilityEvent object directly at INFO level. With a structured
JSON logging layout, the event could be serialized as an object rather
than via toString(), causing the layout to traverse the event source
(a SimpleBrokerMessageHandler) object graph. That graph contains a
cyclic reference through the client inbound channel executor's thread
factory, which fails serialization at the maximum nesting depth.

This commit logs the event's toString() representation instead, keeping
the same operational signal while preventing structured logging layouts
from traversing framework internals.

Signed-off-by: kodacme <kodac.saito@kodac.me>
This commit is contained in:
kodacme
2026-09-04 16:37:30 +02:00
committed by Brian Clozel
parent 8c151f5887
commit 2d478f7d9b
@@ -334,7 +334,7 @@ public abstract class AbstractBrokerMessageHandler
boolean shouldPublish = this.brokerAvailable.compareAndSet(false, true);
if (this.eventPublisher != null && shouldPublish) {
if (logger.isInfoEnabled()) {
logger.info(this.availableEvent);
logger.info(this.availableEvent.toString());
}
this.eventPublisher.publishEvent(this.availableEvent);
}
@@ -344,7 +344,7 @@ public abstract class AbstractBrokerMessageHandler
boolean shouldPublish = this.brokerAvailable.compareAndSet(true, false);
if (this.eventPublisher != null && shouldPublish) {
if (logger.isInfoEnabled()) {
logger.info(this.notAvailableEvent);
logger.info(this.notAvailableEvent.toString());
}
this.eventPublisher.publishEvent(this.notAvailableEvent);
}