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, JMSFactoryType cfType, final List<String> connectorNames, final String clientID, final long clientFailureCheckPeriod, final long connectionTTL, final long callTimeout, final long callFailoverTimeout, final boolean cacheLargeMessagesClient, final int minLargeMessageSize, final boolean compressLargeMessage, 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, String... registryBindings) throws Exception {
checkInitialised();
ActiveMQConnectionFactory cf = connectionFactories.get(name);
if (cf == null) {
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(name).setHA(ha).setConnectorNames(connectorNames).setClientID(clientID).setClientFailureCheckPeriod(clientFailureCheckPeriod).setConnectionTTL(connectionTTL).setFactoryType(cfType).setCallTimeout(callTimeout).setCallFailoverTimeout(callFailoverTimeout).setCacheLargeMessagesClient(cacheLargeMessagesClient).setMinLargeMessageSize(minLargeMessageSize).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).setGroupID(groupId);
createConnectionFactory(true, configuration, registryBindings);
}
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class PersistedConnectionFactory method decode.
@Override
public void decode(final ActiveMQBuffer buffer) {
config = new ConnectionFactoryConfigurationImpl();
config.decode(buffer);
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class StoreConfigTest method testCreateQueue.
@Test
public void testCreateQueue() throws Exception {
server.getConfiguration().getConnectorConfigurations().put("tst", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
// server.getConfiguration().getConnectorConfigurations().put("np", new TransportConfiguration(INVM_CONNECTOR_FACTORY));
List<String> transportConfigurations = new ArrayList<>();
transportConfigurations.add("tst");
ConnectionFactoryConfigurationImpl factCFG = (ConnectionFactoryConfigurationImpl) new ConnectionFactoryConfigurationImpl().setName("tst").setConnectorNames(transportConfigurations);
jmsServer.createConnectionFactory(true, factCFG, "/someCF");
assertTrue(jmsServer.createQueue(true, "queue1", null, true, "/q1", "/q.1"));
assertFalse(jmsServer.createQueue(true, "queue1", "someWeirdThing", true, "/qx", "/qz"));
assertNullJNDI("/qx");
assertNullJNDI("/qz");
assertTrue(jmsServer.createQueue(false, "queue2", null, true, "/q2", "/q.2"));
checkDestination("/q1");
checkDestination("/q.1");
checkDestination("/q2");
checkDestination("/q.2");
jmsServer.stop();
assertNullJNDI("/q1");
assertNullJNDI("/q1.1");
assertNullJNDI("/qI");
assertNullJNDI("/q2");
assertNullJNDI("/q.2");
jmsServer.start();
checkDestination("/q1");
checkDestination("/q.1");
assertNullJNDI("/q2");
assertNullJNDI("/q.2");
jmsServer.addQueueToBindingRegistry("queue1", "/qI");
jmsServer.stop();
jmsServer.start();
checkDestination("/qI");
checkDestination("/q1");
checkDestination("/q.1");
assertNullJNDI("/q2");
assertNullJNDI("/q.2");
assertTrue(jmsServer.removeQueueFromBindingRegistry("queue1", "/q1"));
assertFalse(jmsServer.removeQueueFromBindingRegistry("queue1", "nothing"));
assertNullJNDI("/q1");
checkDestination("/q.1");
checkDestination("/qI");
jmsServer.stop();
jmsServer.start();
assertNullJNDI("/q1");
checkDestination("/q.1");
checkDestination("/qI");
jmsServer.removeQueueFromBindingRegistry("queue1");
assertTrue(jmsServer.createQueue(true, "queue1", null, true, "/newq1", "/newq.1"));
assertNullJNDI("/q1");
assertNullJNDI("/q.1");
assertNullJNDI("/qI");
checkDestination("/newq1");
checkDestination("newq.1");
jmsServer.stop();
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class ConnectionFactorySerializationTest method createStaticFactory.
private void createStaticFactory(boolean b) throws Exception {
HashMap<String, Object> params = new HashMap<>();
Set<String> allowableConnectorKeys = TransportConstants.ALLOWABLE_CONNECTOR_KEYS;
for (String allowableConnectorKey : allowableConnectorKeys) {
String value = RandomUtil.randomString();
params.put(allowableConnectorKey, value);
}
params.put("host", "localhost0");
params.put("port", "1234");
TransportConfiguration main = new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params);
jmsServer.getActiveMQServer().getConfiguration().getConnectorConfigurations().put(main.getName(), main);
HashMap<String, Object> params2 = new HashMap<>();
for (String allowableConnectorKey : allowableConnectorKeys) {
String value = RandomUtil.randomString();
params2.put(allowableConnectorKey, value);
}
params2.put("host", "localhost1");
params2.put("port", "5678");
TransportConfiguration main2 = new TransportConfiguration(NETTY_CONNECTOR_FACTORY, params2);
jmsServer.getActiveMQServer().getConfiguration().getConnectorConfigurations().put(main2.getName(), main2);
ArrayList<String> connectorNames = new ArrayList<>();
connectorNames.add(main.getName());
connectorNames.add(main2.getName());
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName("MyConnectionFactory").setHA(b).setConnectorNames(connectorNames).setClientID("clientID").setClientFailureCheckPeriod(-1).setConnectionTTL(-2).setFactoryType(JMSFactoryType.CF).setCallTimeout(-3).setCallFailoverTimeout(-4).setCacheLargeMessagesClient(b).setMinLargeMessageSize(-5).setConsumerWindowSize(-6).setConsumerMaxRate(-7).setConfirmationWindowSize(-8).setProducerWindowSize(-9).setProducerMaxRate(-10).setBlockOnAcknowledge(b).setBlockOnDurableSend(b).setBlockOnNonDurableSend(b).setAutoGroup(b).setPreAcknowledge(b).setLoadBalancingPolicyClassName("foobar").setTransactionBatchSize(-11).setDupsOKBatchSize(-12).setUseGlobalPools(b).setScheduledThreadPoolMaxSize(-13).setThreadPoolMaxSize(-14).setRetryInterval(-15).setRetryIntervalMultiplier(-16).setMaxRetryInterval(-17).setReconnectAttempts(-18).setFailoverOnInitialConnection(b).setGroupID("groupID").setInitialMessagePacketSize(1499);
jmsServer.createConnectionFactory(false, configuration, "/MyConnectionFactory");
}
use of org.apache.activemq.artemis.jms.server.config.impl.ConnectionFactoryConfigurationImpl in project activemq-artemis by apache.
the class JMSTestBase method createCF.
/**
* @param cfName the unique ConnectionFactory's name
* @param connectorConfigs initial static connectors' config
* @param jndiBindings JNDI binding names for the CF
* @throws Exception
*/
protected void createCF(final String cfName, final List<TransportConfiguration> connectorConfigs, final String... jndiBindings) throws Exception {
List<String> connectorNames = registerConnectors(server, connectorConfigs);
ConnectionFactoryConfiguration configuration = new ConnectionFactoryConfigurationImpl().setName(cfName).setConnectorNames(connectorNames).setRetryInterval(1000).setReconnectAttempts(-1);
testCaseCfExtraConfig(configuration);
jmsServer.createConnectionFactory(false, configuration, jndiBindings);
}
Aggregations