Search in sources :

Example 1 with ProtocolManagerFactory

use of org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory in project activemq-artemis by apache.

the class RemotingServiceImpl method createAcceptor.

@Override
public Acceptor createAcceptor(TransportConfiguration info) {
    Acceptor acceptor = null;
    try {
        AcceptorFactory factory = server.getServiceRegistry().getAcceptorFactory(info.getName(), info.getFactoryClassName());
        Map<String, ProtocolManagerFactory> selectedProtocolFactories = new ConcurrentHashMap<>();
        @SuppressWarnings("deprecation") String protocol = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOL_PROP_NAME, null, info.getParams());
        if (protocol != null) {
            ActiveMQServerLogger.LOGGER.warnDeprecatedProtocol();
            locateProtocols(protocol, info, selectedProtocolFactories);
        }
        String protocols = ConfigurationHelper.getStringProperty(TransportConstants.PROTOCOLS_PROP_NAME, null, info.getParams());
        if (protocols != null) {
            locateProtocols(protocols, info, selectedProtocolFactories);
        }
        ClusterConnection clusterConnection = lookupClusterConnection(info);
        // If empty: we get the default list
        if (selectedProtocolFactories.isEmpty()) {
            selectedProtocolFactories = protocolMap;
        }
        Map<String, ProtocolManager> selectedProtocols = new ConcurrentHashMap<>();
        for (Entry<String, ProtocolManagerFactory> entry : selectedProtocolFactories.entrySet()) {
            selectedProtocols.put(entry.getKey(), entry.getValue().createProtocolManager(server, info.getExtraParams(), incomingInterceptors, outgoingInterceptors));
        }
        acceptor = factory.createAcceptor(info.getName(), clusterConnection, info.getParams(), new DelegatingBufferHandler(), this, threadPool, scheduledThreadPool, selectedProtocols);
        if (defaultInvmSecurityPrincipal != null && acceptor.isUnsecurable()) {
            acceptor.setDefaultActiveMQPrincipal(defaultInvmSecurityPrincipal);
        }
        acceptors.put(info.getName(), acceptor);
        if (managementService != null) {
            acceptor.setNotificationService(managementService);
            managementService.registerAcceptor(acceptor, info);
        }
    } catch (Exception e) {
        ActiveMQServerLogger.LOGGER.errorCreatingAcceptor(e, info.getFactoryClassName());
    }
    return acceptor;
}
Also used : Acceptor(org.apache.activemq.artemis.spi.core.remoting.Acceptor) ProtocolManagerFactory(org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory) CoreProtocolManagerFactory(org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ActiveMQRemoteDisconnectException(org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException) ActiveMQInterruptedException(org.apache.activemq.artemis.api.core.ActiveMQInterruptedException) ClusterConnection(org.apache.activemq.artemis.core.server.cluster.ClusterConnection) ProtocolManager(org.apache.activemq.artemis.spi.core.protocol.ProtocolManager) AcceptorFactory(org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 2 with ProtocolManagerFactory

use of org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory in project activemq-artemis by apache.

the class RemotingServiceImpl method loadProtocolManagerFactories.

/**
 * Loads the protocols found into a map.
 *
 * @param protocolManagerFactoryCollection
 */
private void loadProtocolManagerFactories(Iterable<ProtocolManagerFactory> protocolManagerFactoryCollection) {
    for (ProtocolManagerFactory next : protocolManagerFactoryCollection) {
        MessagePersister.registerProtocol(next);
        String[] protocols = next.getProtocols();
        for (String protocol : protocols) {
            ActiveMQServerLogger.LOGGER.addingProtocolSupport(protocol, next.getModuleName());
            protocolMap.put(protocol, next);
        }
    }
}
Also used : ProtocolManagerFactory(org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory) CoreProtocolManagerFactory(org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory)

Aggregations

CoreProtocolManagerFactory (org.apache.activemq.artemis.core.protocol.core.impl.CoreProtocolManagerFactory)2 ProtocolManagerFactory (org.apache.activemq.artemis.spi.core.protocol.ProtocolManagerFactory)2 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)1 ActiveMQInterruptedException (org.apache.activemq.artemis.api.core.ActiveMQInterruptedException)1 ActiveMQRemoteDisconnectException (org.apache.activemq.artemis.api.core.ActiveMQRemoteDisconnectException)1 ClusterConnection (org.apache.activemq.artemis.core.server.cluster.ClusterConnection)1 ProtocolManager (org.apache.activemq.artemis.spi.core.protocol.ProtocolManager)1 Acceptor (org.apache.activemq.artemis.spi.core.remoting.Acceptor)1 AcceptorFactory (org.apache.activemq.artemis.spi.core.remoting.AcceptorFactory)1