Binding binding = getBinding(queueName);
if (binding != null)
{
// We have a local queue
Queue queue = (Queue)binding.getBindable();
AddressSettings addressSettings = addressSettingsRepository.getMatch(binding.getAddress()
.toString());
long redistributionDelay = addressSettings.getRedistributionDelay();
if (redistributionDelay != -1)
{
queue.addRedistributor(redistributionDelay);
}
}
}
break;
}
case CONSUMER_CLOSED:
{
TypedProperties props = notification.getProperties();
SimpleString clusterName = props.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME);
if (clusterName == null)
{
throw new IllegalStateException("No cluster name");
}
SimpleString filterString = props.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING);
QueueInfo info = queueInfos.get(clusterName);
if (info == null)
{
return;
}
info.decrementConsumers();
if (filterString != null)
{
List<SimpleString> filterStrings = info.getFilterStrings();
filterStrings.remove(filterString);
}
if (info.getNumberOfConsumers() == 0)
{
if (!props.containsProperty(ManagementHelper.HDR_DISTANCE))
{
throw new IllegalStateException("No cluster name");
}
int distance = props.getIntProperty(ManagementHelper.HDR_DISTANCE);
if (distance == 0)
{
SimpleString queueName = props.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME);
if (queueName == null)
{
throw new IllegalStateException("No queue name");
}
Binding binding = getBinding(queueName);
if (binding == null)
{
throw new IllegalStateException("No queue " + queueName);
}
Queue queue = (Queue)binding.getBindable();
AddressSettings addressSettings = addressSettingsRepository.getMatch(binding.getAddress()
.toString());
long redistributionDelay = addressSettings.getRedistributionDelay();
if (redistributionDelay != -1)
{
queue.addRedistributor(redistributionDelay);
}
}
}
break;