private synchronized void doBindingAdded(final ClientMessage message) throws Exception { if (HornetQServerLogger.LOGGER.isTraceEnabled()) { HornetQServerLogger.LOGGER.trace(ClusterConnectionImpl.this + " Adding binding " + message); } if (!message.containsProperty(ManagementHelper.HDR_DISTANCE)) { throw new IllegalStateException("distance is null"); } if (!message.containsProperty(ManagementHelper.HDR_ADDRESS)) { throw new IllegalStateException("queueAddress is null"); } if (!message.containsProperty(ManagementHelper.HDR_CLUSTER_NAME)) { throw new IllegalStateException("clusterName is null"); } if (!message.containsProperty(ManagementHelper.HDR_ROUTING_NAME)) { throw new IllegalStateException("routingName is null"); } if (!message.containsProperty(ManagementHelper.HDR_BINDING_ID)) { throw new IllegalStateException("queueID is null"); } Integer distance = message.getIntProperty(ManagementHelper.HDR_DISTANCE); SimpleString queueAddress = message.getSimpleStringProperty(ManagementHelper.HDR_ADDRESS); SimpleString clusterName = message.getSimpleStringProperty(ManagementHelper.HDR_CLUSTER_NAME); SimpleString routingName = message.getSimpleStringProperty(ManagementHelper.HDR_ROUTING_NAME); SimpleString filterString = message.getSimpleStringProperty(ManagementHelper.HDR_FILTERSTRING); Long queueID = message.getLongProperty(ManagementHelper.HDR_BINDING_ID); RemoteQueueBinding binding = new RemoteQueueBindingImpl( server.getStorageManager().generateUniqueID(), queueAddress, clusterName, routingName, queueID, filterString, queue, bridge.getName(), distance + 1); if (postOffice.getBinding(clusterName) != null) { // Sanity check - this means the binding has already been added via another bridge, probably // max // hops is too high // or there are multiple cluster connections for the same address HornetQServerLogger.LOGGER.remoteQueueAlreadyBoundOnClusterConnection(this, clusterName); return; } if (isTrace) { HornetQServerLogger.LOGGER.trace( "Adding binding " + clusterName + " into " + ClusterConnectionImpl.this); } bindings.put(clusterName, binding); try { postOffice.addBinding(binding); } catch (Exception ignore) { } Bindings theBindings = postOffice.getBindingsForAddress(queueAddress); theBindings.setRouteWhenNoConsumers(routeWhenNoConsumers); }