return;
}
Queue queue = (Queue)binding.getBindable();
ServerLocatorInternal serverLocator;
if (config.getDiscoveryGroupName() != null)
{
DiscoveryGroupConfiguration discoveryGroupConfiguration = configuration.getDiscoveryGroupConfigurations()
.get(config.getDiscoveryGroupName());
if (discoveryGroupConfiguration == null)
{
HornetQServerLogger.LOGGER.bridgeNoDiscoveryGroup(config.getDiscoveryGroupName());
return;
}
if (config.isHA())
{
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(discoveryGroupConfiguration);
}
else
{
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(discoveryGroupConfiguration);
}
}
else
{
TransportConfiguration[] tcConfigs = ClusterConfigurationUtil.connectorNameListToArray(config.getStaticConnectors(), configuration);
if (tcConfigs == null)
{
HornetQServerLogger.LOGGER.bridgeCantFindConnectors(config.getName());
return;
}
if (config.isHA())
{
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithHA(tcConfigs);
}
else
{
serverLocator = (ServerLocatorInternal)HornetQClient.createServerLocatorWithoutHA(tcConfigs);
}
}
if (config.getForwardingAddress() != null)
{
AddressSettings addressConfig = configuration.getAddressesSettings().get(config.getForwardingAddress());
// The address config could be null on certain test cases or some Embedded environment
if (addressConfig == null)
{
// We will certainly have this warning on testcases which is ok
HornetQServerLogger.LOGGER.bridgeCantFindAddressConfig(config.getName(), config.getForwardingAddress());
}
else
{
final int windowSize = config.getConfirmationWindowSize();
final long maxBytes = addressConfig.getMaxSizeBytes();
if (maxBytes !=-1 && maxBytes < windowSize)
{
HornetQServerLogger.LOGGER.bridgeConfirmationWindowTooSmall(config.getName(),
config.getForwardingAddress(), windowSize,
maxBytes);
}
}
}
serverLocator.setIdentity("Bridge " + config.getName());
serverLocator.setConfirmationWindowSize(config.getConfirmationWindowSize());
// We are going to manually retry on the bridge in case of failure
serverLocator.setReconnectAttempts(0);
serverLocator.setInitialConnectAttempts(0);
serverLocator.setRetryInterval(config.getRetryInterval());
serverLocator.setMaxRetryInterval(config.getMaxRetryInterval());
serverLocator.setRetryIntervalMultiplier(config.getRetryIntervalMultiplier());
serverLocator.setClientFailureCheckPeriod(config.getClientFailureCheckPeriod());
serverLocator.setConnectionTTL(config.getConnectionTTL());
serverLocator.setBlockOnDurableSend(!config.isUseDuplicateDetection());
serverLocator.setBlockOnNonDurableSend(!config.isUseDuplicateDetection());
serverLocator.setMinLargeMessageSize(config.getMinLargeMessageSize());
//disable flow control
serverLocator.setProducerWindowSize(-1);
// This will be set to 30s unless it's changed from embedded / testing
// there is no reason to exception the config for this timeout
// since the Bridge is supposed to be non-blocking and fast
// We may expose this if we find a good use case
serverLocator.setCallTimeout(config.getCallTimeout());
serverLocator.addIncomingInterceptor(new IncomingInterceptorLookingForExceptionMessage(this, executor));
if (!config.isUseDuplicateDetection())
{
HornetQServerLogger.LOGGER.debug("Bridge " + config.getName() +
" is configured to not use duplicate detecion, it will send messages synchronously");