Search in sources :

Example 6 with ActiveMQComponent

use of org.apache.activemq.artemis.core.server.ActiveMQComponent in project activemq-artemis by apache.

the class NettyAcceptorFactoryTest method testCreateAcceptor.

@Test
public void testCreateAcceptor() throws Exception {
    NettyAcceptorFactory factory = new NettyAcceptorFactory();
    Map<String, Object> params = new HashMap<>();
    BufferHandler handler = new BufferHandler() {

        @Override
        public void bufferReceived(final Object connectionID, final ActiveMQBuffer buffer) {
        }
    };
    ServerConnectionLifeCycleListener listener = new ServerConnectionLifeCycleListener() {

        @Override
        public void connectionException(final Object connectionID, final ActiveMQException me) {
        }

        @Override
        public void connectionDestroyed(final Object connectionID) {
        }

        @Override
        public void connectionCreated(ActiveMQComponent component, final Connection connection, final ProtocolManager protocol) {
        }

        @Override
        public void connectionReadyForWrites(Object connectionID, boolean ready) {
        }
    };
    Acceptor acceptor = factory.createAcceptor("netty", null, params, handler, listener, Executors.newCachedThreadPool(ActiveMQThreadFactory.defaultThreadFactory()), Executors.newScheduledThreadPool(ActiveMQDefaultConfiguration.getDefaultScheduledThreadPoolMaxSize(), ActiveMQThreadFactory.defaultThreadFactory()), new HashMap<String, ProtocolManager>());
    Assert.assertTrue(acceptor instanceof NettyAcceptor);
}
Also used : ActiveMQComponent(org.apache.activemq.artemis.core.server.ActiveMQComponent) NettyAcceptor(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor) Acceptor(org.apache.activemq.artemis.spi.core.remoting.Acceptor) HashMap(java.util.HashMap) NettyAcceptor(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor) Connection(org.apache.activemq.artemis.spi.core.remoting.Connection) NettyAcceptorFactory(org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptorFactory) ServerConnectionLifeCycleListener(org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener) BufferHandler(org.apache.activemq.artemis.spi.core.remoting.BufferHandler) ActiveMQException(org.apache.activemq.artemis.api.core.ActiveMQException) ProtocolManager(org.apache.activemq.artemis.spi.core.protocol.ProtocolManager) ActiveMQBuffer(org.apache.activemq.artemis.api.core.ActiveMQBuffer) Test(org.junit.Test)

Example 7 with ActiveMQComponent

use of org.apache.activemq.artemis.core.server.ActiveMQComponent in project activemq-artemis by apache.

the class OsgiBroker method getComponentsByStartOrder.

/*
    * this makes sure the components are started in the correct order. Its
    * simple at the mo as e only have core and jms but will need impproving if
    * we get more.
    */
public ArrayList<ActiveMQComponent> getComponentsByStartOrder(Map<String, ActiveMQComponent> components) {
    ArrayList<ActiveMQComponent> activeMQComponents = new ArrayList<>();
    ActiveMQComponent jmsComponent = components.get("jms");
    if (jmsComponent != null) {
        activeMQComponents.add(jmsComponent);
    }
    activeMQComponents.add(components.get("core"));
    return activeMQComponents;
}
Also used : ActiveMQComponent(org.apache.activemq.artemis.core.server.ActiveMQComponent) ArrayList(java.util.ArrayList)

Aggregations

ActiveMQComponent (org.apache.activemq.artemis.core.server.ActiveMQComponent)7 ArrayList (java.util.ArrayList)3 ActiveMQException (org.apache.activemq.artemis.api.core.ActiveMQException)3 HashMap (java.util.HashMap)2 ActiveMQBuffer (org.apache.activemq.artemis.api.core.ActiveMQBuffer)2 NettyAcceptor (org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor)2 ProtocolManager (org.apache.activemq.artemis.spi.core.protocol.ProtocolManager)2 BufferHandler (org.apache.activemq.artemis.spi.core.remoting.BufferHandler)2 Connection (org.apache.activemq.artemis.spi.core.remoting.Connection)2 ServerConnectionLifeCycleListener (org.apache.activemq.artemis.spi.core.remoting.ServerConnectionLifeCycleListener)2 Test (org.junit.Test)2 File (java.io.File)1 IOException (java.io.IOException)1 List (java.util.List)1 ActiveMQDeleteAddressException (org.apache.activemq.artemis.api.core.ActiveMQDeleteAddressException)1 ActiveMQQueueExistsException (org.apache.activemq.artemis.api.core.ActiveMQQueueExistsException)1 SimpleString (org.apache.activemq.artemis.api.core.SimpleString)1 CoreAddressConfiguration (org.apache.activemq.artemis.core.config.CoreAddressConfiguration)1 CoreQueueConfiguration (org.apache.activemq.artemis.core.config.CoreQueueConfiguration)1 FileDeploymentManager (org.apache.activemq.artemis.core.config.FileDeploymentManager)1