ARTEMIS-4434 Some trivial logging about Redistribution

This commit is contained in:
Clebert Suconic 2023-09-21 09:59:31 -04:00 committed by clebertsuconic
parent 8c3f052e87
commit b74f47867f
3 changed files with 18 additions and 1 deletions

View File

@ -218,16 +218,20 @@ public final class BindingsImpl implements Bindings {
final RoutingContext context) throws Exception {
final MessageLoadBalancingType loadBalancingType = this.messageLoadBalancingType;
if (loadBalancingType.equals(MessageLoadBalancingType.STRICT) || loadBalancingType.equals(MessageLoadBalancingType.OFF)) {
logger.debug("Rejecting redistribution of message={} as the loadBalancingType is {}", message, loadBalancingType);
return null;
}
logger.trace("Redistributing message {}", message);
if (logger.isDebugEnabled()) {
logger.debug("Redistributing message {}, originatingQueue={}, currentBindings={}", message, originatingQueue.getName(), this.name);
}
final SimpleString routingName = CompositeAddress.isFullyQualified(message.getAddress()) && originatingQueue.getRoutingType() == RoutingType.ANYCAST ? CompositeAddress.extractAddressName(message.getAddressSimpleString()) : originatingQueue.getName();
final Pair<Binding[], CopyOnWriteBindings.BindingIndex> bindingsAndPosition = routingNameBindingMap.getBindings(routingName);
if (bindingsAndPosition == null) {
logger.debug("Rejecting message redistribution for message={} as bindingsAndPosition is null", message);
// The value can become null if it's concurrently removed while we're iterating - this is expected
// ConcurrentHashMap behaviour!
return null;
@ -259,6 +263,7 @@ public final class BindingsImpl implements Bindings {
}
}
if (nextBinding == null) {
logger.debug("there was no nextBinding, returning null while redistributing message={}", message);
return null;
}
@ -279,6 +284,7 @@ public final class BindingsImpl implements Bindings {
bindingIndex.setIndex(nextPosition);
nextBinding.route(copyRedistribute, context);
logger.debug("Redistribution successful on message={}, towards bindings={}", message, bindings);
return copyRedistribute;
}

View File

@ -1394,6 +1394,9 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
Bindings bindings = addressManager.getBindingsForRoutingAddress(message.getAddressSimpleString());
if (bindings != null && bindings.allowRedistribute()) {
if (logger.isDebugEnabled()) {
logger.debug("Redistributing message {}, originatingQueue={}, bindings={}", message, originatingQueue.getName(), bindings);
}
RoutingContext context = new RoutingContextImpl(null);
// the redistributor will make a copy of the message if it can be redistributed
@ -1401,7 +1404,11 @@ public class PostOfficeImpl implements PostOffice, NotificationListener, Binding
if (redistributedMessage != null) {
return new Pair<>(context, redistributedMessage);
} else {
logger.debug("Redistribution of message {} did not happen because bindings.redistribute returned null", message);
}
} else {
logger.debug("not able to redistribute message={} towards bindings={}", message, bindings);
}
return null;

View File

@ -113,6 +113,10 @@ public class Redistributor implements Consumer {
return HandleStatus.NO_MATCH;
}
if (logger.isDebugEnabled()) {
logger.debug("Redistributing message {}, originatingQueue={}", reference.getMessage(), queue.getName());
}
final Pair<RoutingContext, Message> routingInfo = postOffice.redistribute(reference.getMessage(), queue);
if (routingInfo == null) {