* @return
* @throws HornetQException
*/
protected HornetQConnectionFactory internalCreateCFPOJO(final ConnectionFactoryConfiguration cfConfig) throws HornetQException
{
HornetQConnectionFactory cf;
if (cfConfig.getDiscoveryGroupName() != null)
{
DiscoveryGroupConfiguration groupConfig = server.getConfiguration()
.getDiscoveryGroupConfigurations()
.get(cfConfig.getDiscoveryGroupName());
if (groupConfig == null)
{
throw new HornetQException(HornetQException.ILLEGAL_STATE,
"Discovery Group '" + cfConfig.getDiscoveryGroupName() +
"' doesn't exist on maing config");
}
if (cfConfig.isHA())
{
cf = HornetQJMSClient.createConnectionFactoryWithHA(groupConfig, cfConfig.getFactoryType());
}
else
{
cf = HornetQJMSClient.createConnectionFactoryWithoutHA(groupConfig, cfConfig.getFactoryType());
}
}
else
{
if (cfConfig.getConnectorNames() == null || cfConfig.getConnectorNames().size() == 0)
{
throw new HornetQException(HornetQException.ILLEGAL_STATE,
"Null Connector name passed to create ConnectionFactory");
}
TransportConfiguration[] configs = new TransportConfiguration[cfConfig.getConnectorNames().size()];
int count = 0;
for (String name : cfConfig.getConnectorNames())
{
TransportConfiguration connector = server.getConfiguration().getConnectorConfigurations().get(name);
if (connector == null)
{
throw new HornetQException(HornetQException.ILLEGAL_STATE, "Connector '" + name +
"' not found on the main configuration file");
}
configs[count++] = connector;
}
if (cfConfig.isHA())
{
cf = HornetQJMSClient.createConnectionFactoryWithHA(cfConfig.getFactoryType(), configs);
}
else
{
cf = HornetQJMSClient.createConnectionFactoryWithoutHA(cfConfig.getFactoryType(), configs);
}
}
cf.setClientID(cfConfig.getClientID());
cf.setClientFailureCheckPeriod(cfConfig.getClientFailureCheckPeriod());
cf.setConnectionTTL(cfConfig.getConnectionTTL());
cf.setCallTimeout(cfConfig.getCallTimeout());
cf.setCacheLargeMessagesClient(cfConfig.isCacheLargeMessagesClient());
cf.setMinLargeMessageSize(cfConfig.getMinLargeMessageSize());
cf.setConsumerWindowSize(cfConfig.getConsumerWindowSize());
cf.setConsumerMaxRate(cfConfig.getConsumerMaxRate());
cf.setConfirmationWindowSize(cfConfig.getConfirmationWindowSize());
cf.setProducerWindowSize(cfConfig.getProducerWindowSize());
cf.setProducerMaxRate(cfConfig.getProducerMaxRate());
cf.setBlockOnAcknowledge(cfConfig.isBlockOnAcknowledge());
cf.setBlockOnDurableSend(cfConfig.isBlockOnDurableSend());
cf.setBlockOnNonDurableSend(cfConfig.isBlockOnNonDurableSend());
cf.setAutoGroup(cfConfig.isAutoGroup());
cf.setPreAcknowledge(cfConfig.isPreAcknowledge());
cf.setConnectionLoadBalancingPolicyClassName(cfConfig.getLoadBalancingPolicyClassName());
cf.setTransactionBatchSize(cfConfig.getTransactionBatchSize());
cf.setDupsOKBatchSize(cfConfig.getDupsOKBatchSize());
cf.setUseGlobalPools(cfConfig.isUseGlobalPools());
cf.setScheduledThreadPoolMaxSize(cfConfig.getScheduledThreadPoolMaxSize());
cf.setThreadPoolMaxSize(cfConfig.getThreadPoolMaxSize());
cf.setRetryInterval(cfConfig.getRetryInterval());
cf.setRetryIntervalMultiplier(cfConfig.getRetryIntervalMultiplier());
cf.setMaxRetryInterval(cfConfig.getMaxRetryInterval());
cf.setReconnectAttempts(cfConfig.getReconnectAttempts());
cf.setFailoverOnInitialConnection(cfConfig.isFailoverOnInitialConnection());
cf.setCompressLargeMessage(cfConfig.isCompressLargeMessages());
cf.setGroupID(cfConfig.getGroupID());
return cf;
}