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()));
}
}
}
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);
}
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);
}
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);
}
}
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;
}
Aggregations