Search in sources :

Example 1 with DiscoveryGroupConfiguration

use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project wildfly by wildfly.

the class DiscoveryGroupAdd method addDiscoveryGroupConfigs.

static void addDiscoveryGroupConfigs(final OperationContext context, final Configuration configuration, final ModelNode model) throws OperationFailedException {
    if (model.hasDefined(CommonAttributes.DISCOVERY_GROUP)) {
        Map<String, DiscoveryGroupConfiguration> configs = configuration.getDiscoveryGroupConfigurations();
        if (configs == null) {
            configs = new HashMap<String, DiscoveryGroupConfiguration>();
            configuration.setDiscoveryGroupConfigurations(configs);
        }
        for (Property prop : model.get(CommonAttributes.DISCOVERY_GROUP).asPropertyList()) {
            configs.put(prop.getName(), createDiscoveryGroupConfiguration(context, prop.getName(), prop.getValue()));
        }
    }
}
Also used : DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) Property(org.jboss.dmr.Property)

Example 2 with DiscoveryGroupConfiguration

use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project wildfly by wildfly.

the class DiscoveryGroupAdd method createDiscoveryGroupConfiguration.

static DiscoveryGroupConfiguration createDiscoveryGroupConfiguration(final String name, final DiscoveryGroupConfiguration config, final JChannel channel, final String channelName) throws Exception {
    final long refreshTimeout = config.getRefreshTimeout();
    final long initialWaitTimeout = config.getDiscoveryInitialWaitTimeout();
    final BroadcastEndpointFactory endpointFactory = new ChannelBroadcastEndpointFactory(channel, channelName);
    return new DiscoveryGroupConfiguration().setName(name).setRefreshTimeout(refreshTimeout).setDiscoveryInitialWaitTimeout(initialWaitTimeout).setBroadcastEndpointFactory(endpointFactory);
}
Also used : ChannelBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) ChannelBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory) UDPBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory) BroadcastEndpointFactory(org.apache.activemq.artemis.api.core.BroadcastEndpointFactory)

Example 3 with DiscoveryGroupConfiguration

use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.

the class JGroupsServerLocatorSchema method internalNewURI.

@Override
protected URI internalNewURI(ServerLocator bean) throws Exception {
    DiscoveryGroupConfiguration dgc = bean.getDiscoveryGroupConfiguration();
    BroadcastEndpointFactory endpoint = dgc.getBroadcastEndpointFactory();
    String auth;
    if (endpoint instanceof JGroupsFileBroadcastEndpointFactory) {
        auth = ((JGroupsFileBroadcastEndpointFactory) endpoint).getChannelName();
    } else if (endpoint instanceof JGroupsPropertiesBroadcastEndpointFactory) {
        auth = ((JGroupsPropertiesBroadcastEndpointFactory) endpoint).getChannelName();
    } else {
        throw new NotSerializableException(endpoint + "not serializable");
    }
    String query = BeanSupport.getData(null, bean, dgc, endpoint);
    dgc.setBroadcastEndpointFactory(endpoint);
    return new URI(SchemaConstants.JGROUPS, null, auth, -1, null, query, null);
}
Also used : NotSerializableException(java.io.NotSerializableException) JGroupsPropertiesBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory) JGroupsFileBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) URI(java.net.URI) JGroupsPropertiesBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory) JGroupsFileBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory) BroadcastEndpointFactory(org.apache.activemq.artemis.api.core.BroadcastEndpointFactory)

Example 4 with DiscoveryGroupConfiguration

use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.

the class JGroupsServerLocatorSchema method internalNewObject.

@Override
protected ServerLocator internalNewObject(URI uri, Map<String, String> query, String name) throws Exception {
    ConnectionOptions options = newConnectionOptions(uri, query);
    DiscoveryGroupConfiguration dcConfig = getDiscoveryGroupConfiguration(uri, query, name);
    if (options.isHa()) {
        return ActiveMQClient.createServerLocatorWithHA(dcConfig);
    } else {
        return ActiveMQClient.createServerLocatorWithoutHA(dcConfig);
    }
}
Also used : DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)

Example 5 with DiscoveryGroupConfiguration

use of org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration in project activemq-artemis by apache.

the class JGroupsServerLocatorSchema method getDiscoveryGroupConfiguration.

public static DiscoveryGroupConfiguration getDiscoveryGroupConfiguration(URI uri, Map<String, String> query, String name) throws Exception {
    BroadcastEndpointFactory endpointFactory;
    if (query.containsKey("file")) {
        endpointFactory = new JGroupsFileBroadcastEndpointFactory().setChannelName(uri.getAuthority());
    } else {
        endpointFactory = new JGroupsPropertiesBroadcastEndpointFactory().setChannelName(uri.getAuthority());
    }
    BeanSupport.setData(uri, endpointFactory, query);
    DiscoveryGroupConfiguration dcConfig = new DiscoveryGroupConfiguration().setName(name).setBroadcastEndpointFactory(endpointFactory);
    BeanSupport.setData(uri, dcConfig, query);
    return dcConfig;
}
Also used : JGroupsPropertiesBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory) JGroupsFileBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory) DiscoveryGroupConfiguration(org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration) JGroupsPropertiesBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory) JGroupsFileBroadcastEndpointFactory(org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory) BroadcastEndpointFactory(org.apache.activemq.artemis.api.core.BroadcastEndpointFactory)

Aggregations

DiscoveryGroupConfiguration (org.apache.activemq.artemis.api.core.DiscoveryGroupConfiguration)61 UDPBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.UDPBroadcastEndpointFactory)32 TransportConfiguration (org.apache.activemq.artemis.api.core.TransportConfiguration)19 ActiveMQConnectionFactory (org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory)19 BroadcastEndpointFactory (org.apache.activemq.artemis.api.core.BroadcastEndpointFactory)18 Test (org.junit.Test)16 ArrayList (java.util.ArrayList)14 JGroupsFileBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.JGroupsFileBroadcastEndpointFactory)12 JGroupsPropertiesBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.JGroupsPropertiesBroadcastEndpointFactory)10 HashMap (java.util.HashMap)9 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)9 URI (java.net.URI)7 BroadcastGroupConfiguration (org.apache.activemq.artemis.api.core.BroadcastGroupConfiguration)7 Map (java.util.Map)6 ChannelBroadcastEndpointFactory (org.apache.activemq.artemis.api.core.ChannelBroadcastEndpointFactory)5 ClusterConnectionConfiguration (org.apache.activemq.artemis.core.config.ClusterConnectionConfiguration)5 HashSet (java.util.HashSet)4 ActiveMQServer (org.apache.activemq.artemis.core.server.ActiveMQServer)4 Before (org.junit.Before)4 Hashtable (java.util.Hashtable)3