use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionControlTest method setUp.
// Package protected ---------------------------------------------
// Protected -----------------------------------------------------
@Override
@Before
public void setUp() throws Exception {
super.setUp();
Map<String, Object> acceptorParams = new HashMap<>();
acceptorParams.put(TransportConstants.SERVER_ID_PROP_NAME, 1);
TransportConfiguration acceptorConfig = new TransportConfiguration(InVMAcceptorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
TransportConfiguration connectorConfig = new TransportConfiguration(InVMConnectorFactory.class.getName(), acceptorParams, RandomUtil.randomString());
CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
List<String> connectors = new ArrayList<>();
connectors.add(connectorConfig.getName());
String discoveryGroupName = RandomUtil.randomString();
DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration().setName(discoveryGroupName).setRefreshTimeout(500).setDiscoveryInitialWaitTimeout(0).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(getUDPDiscoveryAddress()).setGroupPort(getUDPDiscoveryPort()));
Configuration conf_1 = createBasicConfig().addAcceptorConfiguration(acceptorConfig).addQueueConfiguration(queueConfig);
clusterConnectionConfig1 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.STRICT).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setStaticConnectors(connectors);
clusterConnectionConfig2 = new ClusterConnectionConfiguration().setName(RandomUtil.randomString()).setAddress(queueConfig.getAddress()).setConnectorName(connectorConfig.getName()).setRetryInterval(RandomUtil.randomPositiveLong()).setDuplicateDetection(RandomUtil.randomBoolean()).setMessageLoadBalancingType(MessageLoadBalancingType.OFF).setMaxHops(RandomUtil.randomPositiveInt()).setConfirmationWindowSize(RandomUtil.randomPositiveInt()).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setDiscoveryGroupName(discoveryGroupName);
Configuration conf_0 = createBasicConfig().addAcceptorConfiguration(new TransportConfiguration(InVMAcceptorFactory.class.getName())).addConnectorConfiguration(connectorConfig.getName(), connectorConfig).addClusterConfiguration(clusterConnectionConfig1).addClusterConfiguration(clusterConnectionConfig2).addDiscoveryGroupConfiguration(discoveryGroupName, discoveryGroupConfig);
mbeanServer_1 = MBeanServerFactory.createMBeanServer();
server_1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, mbeanServer_1, false));
server_1.start();
server_0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
server_0.start();
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionControl2Test method setUp.
@Override
@Before
public void setUp() throws Exception {
super.setUp();
String discoveryName = RandomUtil.randomString();
String groupAddress = getUDPDiscoveryAddress();
int groupPort = getUDPDiscoveryPort();
Map<String, Object> acceptorParams_1 = new HashMap<>();
acceptorParams_1.put(TransportConstants.PORT_PROP_NAME, port_1);
TransportConfiguration acceptorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY);
TransportConfiguration acceptorConfig_1 = new TransportConfiguration(ActiveMQTestBase.NETTY_ACCEPTOR_FACTORY, acceptorParams_1);
TransportConfiguration connectorConfig_1 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY, acceptorParams_1);
TransportConfiguration connectorConfig_0 = new TransportConfiguration(ActiveMQTestBase.NETTY_CONNECTOR_FACTORY);
CoreQueueConfiguration queueConfig = new CoreQueueConfiguration().setAddress(RandomUtil.randomString()).setName(RandomUtil.randomString()).setDurable(false);
List<String> connectorInfos = new ArrayList<>();
connectorInfos.add("netty");
BroadcastGroupConfiguration broadcastGroupConfig = new BroadcastGroupConfiguration().setName(discoveryName).setBroadcastPeriod(250).setConnectorInfos(connectorInfos).setEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort));
DiscoveryGroupConfiguration discoveryGroupConfig = new DiscoveryGroupConfiguration().setName(discoveryName).setRefreshTimeout(0).setDiscoveryInitialWaitTimeout(0).setBroadcastEndpointFactory(new UDPBroadcastEndpointFactory().setGroupAddress(groupAddress).setGroupPort(groupPort));
clusterConnectionConfig_0 = new ClusterConnectionConfiguration().setName(clusterName).setAddress(queueConfig.getAddress()).setConnectorName("netty").setRetryInterval(1000).setDuplicateDetection(false).setMessageLoadBalancingType(MessageLoadBalancingType.ON_DEMAND).setMaxHops(1).setConfirmationWindowSize(1024).setDiscoveryGroupName(discoveryName);
Configuration conf_1 = createBasicConfig().addClusterConfiguration(clusterConnectionConfig_0).addAcceptorConfiguration(acceptorConfig_1).addConnectorConfiguration("netty", connectorConfig_1).addQueueConfiguration(queueConfig).addDiscoveryGroupConfiguration(discoveryName, discoveryGroupConfig).addBroadcastGroupConfiguration(broadcastGroupConfig);
Configuration conf_0 = createBasicConfig(1).addClusterConfiguration(clusterConnectionConfig_0).addAcceptorConfiguration(acceptorConfig_0).addConnectorConfiguration("netty", connectorConfig_0).addDiscoveryGroupConfiguration(discoveryName, discoveryGroupConfig).addBroadcastGroupConfiguration(broadcastGroupConfig);
mbeanServer_1 = MBeanServerFactory.createMBeanServer();
server1 = addServer(ActiveMQServers.newActiveMQServer(conf_1, mbeanServer_1, false));
server0 = addServer(ActiveMQServers.newActiveMQServer(conf_0, mbeanServer, false));
server0.start();
waitForServerToStart(server0);
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionConfigurationTest method testClusterConnectionMulticast.
@Test
public void testClusterConnectionMulticast() throws Exception {
ClusterConnectionConfigurationParser parser = new ClusterConnectionConfigurationParser();
ClusterConnectionConfiguration configuration = parser.newObject(new URI("multicast://myGroup?minLargeMessageSize=132"), null);
Assert.assertEquals("myGroup", configuration.getDiscoveryGroupName());
Assert.assertEquals(132, configuration.getMinLargeMessageSize());
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionConfigurationTest method testClusterConnectionStatic2.
@Test
public void testClusterConnectionStatic2() throws Exception {
ClusterConnectionConfigurationParser parser = new ClusterConnectionConfigurationParser();
ClusterConnectionConfiguration configuration = parser.newObject(new URI("static://(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132;messageLoadBalancingType=OFF"), null);
Assert.assertEquals(132, configuration.getMinLargeMessageSize());
Assert.assertEquals(2, configuration.getCompositeMembers().getComponents().length);
Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString());
Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString());
}
use of org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration in project activemq-artemis by apache.
the class ClusterConnectionConfigurationTest method testClusterConnectionStaticOnConstrcutor.
@Test
public void testClusterConnectionStaticOnConstrcutor() throws Exception {
ClusterConnectionConfiguration configuration = new ClusterConnectionConfiguration(new URI("static:(tcp://localhost:6556,tcp://localhost:6557)?minLargeMessageSize=132"));
Assert.assertEquals(132, configuration.getMinLargeMessageSize());
Assert.assertEquals("tcp://localhost:6556", configuration.getCompositeMembers().getComponents()[0].toString());
Assert.assertEquals("tcp://localhost:6557", configuration.getCompositeMembers().getComponents()[1].toString());
}
Aggregations