use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.
the class JGroupsSchema method internalNewObject.
@Override
public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
JMSConnectionOptions options = newConectionOptions(uri, query);
DiscoveryGroupConfiguration dcConfig = JGroupsServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query, name);
ActiveMQConnectionFactory factory;
if (options.isHa()) {
factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dcConfig, options.getFactoryTypeEnum());
} else {
factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dcConfig, options.getFactoryTypeEnum());
}
return BeanSupport.setData(uri, factory, query);
}
use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.
the class UDPSchema method internalNewObject.
@Override
public ActiveMQConnectionFactory internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
JMSConnectionOptions options = newConectionOptions(uri, query);
DiscoveryGroupConfiguration dgc = UDPServerLocatorSchema.getDiscoveryGroupConfiguration(uri, query, getHost(uri), getPort(uri), name);
ActiveMQConnectionFactory factory;
if (options.isHa()) {
factory = ActiveMQJMSClient.createConnectionFactoryWithHA(dgc, options.getFactoryTypeEnum());
} else {
factory = ActiveMQJMSClient.createConnectionFactoryWithoutHA(dgc, options.getFactoryTypeEnum());
}
return BeanSupport.setData(uri, factory, query);
}
use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.
the class UDPSchema method internalNewURI.
@Override
protected URI internalNewURI(ActiveMQConnectionFactory bean) throws Exception {
DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
UDPBroadcastEndpointFactory endpoint = (UDPBroadcastEndpointFactory) dgc.getBroadcastEndpointFactory();
String query = BeanSupport.getData(UDPServerLocatorSchema.IGNORED, bean, dgc, endpoint);
dgc.setBroadcastEndpointFactory(endpoint);
return new URI(SchemaConstants.UDP, null, endpoint.getGroupAddress(), endpoint.getGroupPort(), null, query, null);
}
use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.
the class ResourceAdapterTest method testCreateConnectionFactoryOverrideDiscovery.
@Test
public void testCreateConnectionFactoryOverrideDiscovery() throws Exception {
ActiveMQResourceAdapter ra = new ActiveMQResourceAdapter();
ra.setConnectorClassName(InVMConnectorFactory.class.getName());
ConnectionFactoryProperties connectionFactoryProperties = new ConnectionFactoryProperties();
connectionFactoryProperties.setDiscoveryAddress("myhost");
connectionFactoryProperties.setDiscoveryPort(5678);
connectionFactoryProperties.setDiscoveryLocalBindAddress("newAddress");
ActiveMQConnectionFactory factory = ra.getConnectionFactory(connectionFactoryProperties);
ActiveMQConnectionFactory defaultFactory = ra.getDefaultActiveMQConnectionFactory();
Assert.assertNotSame(factory, defaultFactory);
DiscoveryGroupConfiguration dc = factory.getServerLocator().getDiscoveryGroupConfiguration();
UDPBroadcastEndpointFactory udpDg = (UDPBroadcastEndpointFactory) dc.getBroadcastEndpointFactory();
Assert.assertEquals(udpDg.getLocalBindAddress(), "newAddress");
Assert.assertEquals(udpDg.getGroupAddress(), "myhost");
Assert.assertEquals(udpDg.getGroupPort(), 5678);
}
use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.
the class SharedNothingLiveActivation method getLocator.
private ServerLocatorInternal getLocator(ClusterConnectionConfiguration config) throws ActiveMQException {
ServerLocatorInternal locator;
if (config.getDiscoveryGroupName() != null) {
DiscoveryGroupConfiguration dg = activeMQServer.getConfiguration().getDiscoveryGroupConfigurations().get(config.getDiscoveryGroupName());
if (dg == null) {
throw ActiveMQMessageBundle.BUNDLE.noDiscoveryGroupFound(dg);
}
locator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(dg);
} else {
TransportConfiguration[] tcConfigs = config.getStaticConnectors() != null ? connectorNameListToArray(config.getStaticConnectors()) : null;
locator = (ServerLocatorInternal) ActiveMQClient.createServerLocatorWithHA(tcConfigs);
}
return locator;
}
Aggregations