use of org.apache.activemq.artemis.api.core.TransportConfiguration in project wildfly by wildfly.
the class TransportConfigOperationHandlers method processAcceptors.
/**
* Process the acceptor information.
*
* @param context the operation context
* @param configuration the ActiveMQ configuration
* @param params the detyped operation parameters
* @param bindings the referenced socket bindings
* @throws OperationFailedException
*/
static void processAcceptors(final OperationContext context, final Configuration configuration, final ModelNode params, final Set<String> bindings) throws OperationFailedException {
final Map<String, TransportConfiguration> acceptors = new HashMap<String, TransportConfiguration>();
if (params.hasDefined(ACCEPTOR)) {
for (final Property property : params.get(ACCEPTOR).asPropertyList()) {
final String acceptorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, ACCEPTOR_KEYS_MAP);
final String clazz = config.get(FACTORY_CLASS.getName()).asString();
ModelNode socketBinding = GenericTransportDefinition.SOCKET_BINDING.resolveModelAttribute(context, config);
if (socketBinding.isDefined()) {
bindings.add(socketBinding.asString());
// uses the parameters to pass the socket binding name that will be read in ActiveMQServerService.start()
parameters.put(GenericTransportDefinition.SOCKET_BINDING.getName(), socketBinding.asString());
}
acceptors.put(acceptorName, new TransportConfiguration(clazz, parameters, acceptorName));
}
}
if (params.hasDefined(REMOTE_ACCEPTOR)) {
for (final Property property : params.get(REMOTE_ACCEPTOR).asPropertyList()) {
final String acceptorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, ACCEPTOR_KEYS_MAP);
final String binding = config.get(RemoteTransportDefinition.SOCKET_BINDING.getName()).asString();
bindings.add(binding);
// uses the parameters to pass the socket binding name that will be read in ActiveMQServerService.start()
parameters.put(RemoteTransportDefinition.SOCKET_BINDING.getName(), binding);
acceptors.put(acceptorName, new TransportConfiguration(NettyAcceptorFactory.class.getName(), parameters, acceptorName));
}
}
if (params.hasDefined(IN_VM_ACCEPTOR)) {
for (final Property property : params.get(IN_VM_ACCEPTOR).asPropertyList()) {
final String acceptorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, ACCEPTOR_KEYS_MAP);
parameters.put(SERVER_ID_PROP_NAME, InVMTransportDefinition.SERVER_ID.resolveModelAttribute(context, config).asInt());
acceptors.put(acceptorName, new TransportConfiguration(InVMAcceptorFactory.class.getName(), parameters, acceptorName));
}
}
if (params.hasDefined(HTTP_ACCEPTOR)) {
for (final Property property : params.get(HTTP_ACCEPTOR).asPropertyList()) {
final String acceptorName = property.getName();
final ModelNode config = property.getValue();
final Map<String, Object> parameters = getParameters(context, config, ACCEPTOR_KEYS_MAP);
parameters.put(TransportConstants.HTTP_UPGRADE_ENABLED_PROP_NAME, true);
acceptors.put(acceptorName, new TransportConfiguration(NettyAcceptorFactory.class.getName(), parameters, acceptorName));
}
}
configuration.setAcceptorConfigurations(new HashSet<TransportConfiguration>(acceptors.values()));
}
Aggregations