use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSConnectionFactoryConfigurationStorageTest method testSizeOfCF.
@Test
public void testSizeOfCF() throws Exception {
String[] str = new String[5];
for (int i = 0; i < 5; i++) {
str[i] = "str" + i;
}
ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(new ArrayList<String>()).setBindings("");
int size = config.getEncodeSize();
ActiveMQBuffer buffer = ActiveMQBuffers.fixedBuffer(size);
config.encode(buffer);
assertEquals(size, buffer.writerIndex());
PersistedConnectionFactory persistedCF = new PersistedConnectionFactory(config);
size = persistedCF.getEncodeSize();
buffer = ActiveMQBuffers.fixedBuffer(size);
persistedCF.encode(buffer);
assertEquals(size, buffer.writerIndex());
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSConnectionFactoryConfigurationStorageTest method testSettings.
@Test
public void testSettings() throws Exception {
createJMSStorage();
List<String> transportConfigs = new ArrayList<>();
for (int i = 0; i < 5; i++) {
transportConfigs.add("c1-" + i);
transportConfigs.add("c2-" + i);
}
ConnectionFactoryConfiguration config = new ConnectionFactoryConfigurationImpl().setName("some-name").setConnectorNames(transportConfigs);
addSetting(new PersistedConnectionFactory(config));
jmsJournal.stop();
createJMSStorage();
List<PersistedConnectionFactory> cfs = jmsJournal.recoverConnectionFactories();
assertEquals(1, cfs.size());
assertEquals("some-name", cfs.get(0).getName());
PersistedConnectionFactory cf1 = cfs.get(0);
assertEquals(10, cf1.getConfig().getConnectorNames().size());
List<String> configs = cf1.getConfig().getConnectorNames();
for (int i = 0, j = 0; i < 10; i += 2, j++) {
assertEquals(configs.get(i), "c1-" + j);
assertEquals(configs.get(i + 1), "c2-" + j);
}
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSServerManagerImpl method createConnectionFactory.
@Override
public synchronized void createConnectionFactory(final String name, final boolean ha, final JMSFactoryType cfType, final String discoveryGroupName, final String clientID, final long clientFailureCheckPeriod, final long connectionTTL, final long callTimeout, final long callFailoverTimeout, final boolean cacheLargeMessagesClient, final int minLargeMessageSize, final boolean compressLargeMessages, final int consumerWindowSize, final int consumerMaxRate, final int confirmationWindowSize, final int producerWindowSize, final int producerMaxRate, final boolean blockOnAcknowledge, final boolean blockOnDurableSend, final boolean blockOnNonDurableSend, final boolean autoGroup, final boolean preAcknowledge, final String loadBalancingPolicyClassName, final int transactionBatchSize, final int dupsOKBatchSize, final boolean useGlobalPools, final int scheduledThreadPoolMaxSize, final int threadPoolMaxSize, final long retryInterval, final double retryIntervalMultiplier, final long maxRetryInterval, final int reconnectAttempts, final boolean failoverOnInitialConnection, final String groupId, final String... registryBindings) throws Exception {
checkInitialised();
ActiveMQConnectionFactory cf = connectionFactories.get(name);
if (cf == null) {
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(name).setHA(ha).setBindings(registryBindings).setDiscoveryGroupName(discoveryGroupName).setFactoryType(cfType).setClientID(clientID).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setCallTimeout(callTimeout).setCallFailoverTimeout(callFailoverTimeout).setCacheLargeMessagesClient(cacheLargeMessagesClient).setMinLargeMessageSize(minLargeMessageSize).setCompressLargeMessages(compressLargeMessages).setConsumerWindowSize(consumerWindowSize).setConsumerMaxRate(consumerMaxRate).setConfirmationWindowSize(confirmationWindowSize).setProducerWindowSize(producerWindowSize).setProducerMaxRate(producerMaxRate).setBlockOnAcknowledge(blockOnAcknowledge).setBlockOnDurableSend(blockOnDurableSend).setBlockOnNonDurableSend(blockOnNonDurableSend).setAutoGroup(autoGroup).setPreAcknowledge(preAcknowledge).setLoadBalancingPolicyClassName(loadBalancingPolicyClassName).setTransactionBatchSize(transactionBatchSize).setDupsOKBatchSize(dupsOKBatchSize).setUseGlobalPools(useGlobalPools).setScheduledThreadPoolMaxSize(scheduledThreadPoolMaxSize).setThreadPoolMaxSize(threadPoolMaxSize).setRetryInterval(retryInterval).setRetryIntervalMultiplier(retryIntervalMultiplier).setMaxRetryInterval(maxRetryInterval).setReconnectAttempts(reconnectAttempts).setFailoverOnInitialConnection(failoverOnInitialConnection);
createConnectionFactory(true, configuration, registryBindings);
}
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSServerManagerImpl method createConnectionFactory.
@Override
public synchronized void createConnectionFactory(final String name, final boolean ha, final JMSFactoryType cfType, final List<String> connectorNames, String... registryBindings) throws Exception {
checkInitialised();
ActiveMQConnectionFactory cf = connectionFactories.get(name);
if (cf == null) {
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(name).setHA(ha).setConnectorNames(connectorNames).setFactoryType(cfType);
createConnectionFactory(true, configuration, registryBindings);
}
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSServerManagerImpl method createConnectionFactory.
@Override
public synchronized void createConnectionFactory(final String name, final boolean ha, final JMSFactoryType cfType, final String discoveryGroupName, final String... registryBindings) throws Exception {
checkInitialised();
ActiveMQConnectionFactory cf = connectionFactories.get(name);
if (cf == null) {
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(name).setHA(ha).setBindings(registryBindings).setDiscoveryGroupName(discoveryGroupName);
createConnectionFactory(true, configuration, registryBindings);
}
}
Aggregations