// Need to lock to make sure all queue info and notifications are in the correct order with no gaps
synchronized (notificationLock)
{
// First send a reset message
ServerMessage message = new ServerMessageImpl(storageManager.generateUniqueID(), 50);
message.setAddress(queueName);
message.putBooleanProperty(PostOfficeImpl.HDR_RESET_QUEUE_DATA, true);
routeQueueInfo(message, queue, false);
for (QueueInfo info : queueInfos.values())
{
if (log.isTraceEnabled())
{
log.trace("QueueInfo on sendQueueInfoToQueue = " + info);
}
if (info.getAddress().startsWith(address))
{
message = createQueueInfoMessage(NotificationType.BINDING_ADDED, queueName);
message.putStringProperty(ManagementHelper.HDR_ADDRESS, info.getAddress());
message.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, info.getClusterName());
message.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, info.getRoutingName());
message.putLongProperty(ManagementHelper.HDR_BINDING_ID, info.getID());
message.putStringProperty(ManagementHelper.HDR_FILTERSTRING, info.getFilterString());
message.putIntProperty(ManagementHelper.HDR_DISTANCE, info.getDistance());
routeQueueInfo(message, queue, true);
int consumersWithFilters = info.getFilterStrings() != null ? info.getFilterStrings().size() : 0;
for (int i = 0; i < info.getNumberOfConsumers() - consumersWithFilters; i++)
{
message = createQueueInfoMessage(NotificationType.CONSUMER_CREATED, queueName);
message.putStringProperty(ManagementHelper.HDR_ADDRESS, info.getAddress());
message.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, info.getClusterName());
message.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, info.getRoutingName());
message.putIntProperty(ManagementHelper.HDR_DISTANCE, info.getDistance());
routeQueueInfo(message, queue, true);
}
if (info.getFilterStrings() != null)
{
for (SimpleString filterString : info.getFilterStrings())
{
message = createQueueInfoMessage(NotificationType.CONSUMER_CREATED, queueName);
message.putStringProperty(ManagementHelper.HDR_ADDRESS, info.getAddress());
message.putStringProperty(ManagementHelper.HDR_CLUSTER_NAME, info.getClusterName());
message.putStringProperty(ManagementHelper.HDR_ROUTING_NAME, info.getRoutingName());
message.putStringProperty(ManagementHelper.HDR_FILTERSTRING, filterString);
message.putIntProperty(ManagementHelper.HDR_DISTANCE, info.getDistance());
routeQueueInfo(message, queue, true);
}
}
}