Search in sources :

Example 6 with Transport

use of org.apache.activemq.transport.Transport in project activemq-artemis by apache.

the class FailoverTransportBrokerTest method createFailoverConnection.

protected StubConnection createFailoverConnection(TransportListener listener) throws Exception {
    URI failoverURI = new URI("failover://" + newURI(0) + "," + newURI(1) + "");
    Transport transport = TransportFactory.connect(failoverURI);
    StubConnection connection = new StubConnection(transport, listener);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport) URI(java.net.URI)

Example 7 with Transport

use of org.apache.activemq.transport.Transport in project activemq-artemis by apache.

the class FanoutTransportBrokerTest method createFanoutConnection.

protected StubConnection createFanoutConnection() throws Exception {
    URI fanoutURI = new URI("fanout://(static://(" + newURI(0) + "," + "mock://" + newURI(1) + "))?fanOutQueues=true");
    Transport transport = TransportFactory.connect(fanoutURI);
    StubConnection connection = new StubConnection(transport);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport) MockTransport(org.apache.activemq.transport.mock.MockTransport) URI(java.net.URI)

Example 8 with Transport

use of org.apache.activemq.transport.Transport in project activemq-artemis by apache.

the class FailoverTransportTest method testReconnectUnlimited.

@Test(timeout = 30000)
@Ignore("Test fails on windows")
public void testReconnectUnlimited() throws Exception {
    Transport transport = TransportFactory.connect(new URI("failover://(tcp://0.0.0.0:61616)?useExponentialBackOff=false&reconnectDelay=0&initialReconnectDelay=0"));
    transport.setTransportListener(new TransportListener() {

        @Override
        public void onCommand(Object command) {
        }

        @Override
        public void onException(IOException error) {
        }

        @Override
        public void transportInterupted() {
        }

        @Override
        public void transportResumed() {
        }
    });
    transport.start();
    this.failoverTransport = transport.narrow(FailoverTransport.class);
    assertTrue("no implicit limit of 1000", Wait.waitFor(new Wait.Condition() {

        @Override
        public boolean isSatisified() throws Exception {
            return failoverTransport.getConnectFailures() > 1002;
        }
    }));
}
Also used : TransportListener(org.apache.activemq.transport.TransportListener) IOException(java.io.IOException) Transport(org.apache.activemq.transport.Transport) URI(java.net.URI) Ignore(org.junit.Ignore) Test(org.junit.Test)

Example 9 with Transport

use of org.apache.activemq.transport.Transport in project activemq-artemis by apache.

the class FailoverTransportTest method createTransport.

protected Transport createTransport() throws Exception {
    Transport transport = TransportFactory.connect(new URI("failover://(tcp://localhost:1234?transport.connectTimeout=10000)"));
    transport.setTransportListener(new TransportListener() {

        @Override
        public void onCommand(Object command) {
        }

        @Override
        public void onException(IOException error) {
        }

        @Override
        public void transportInterupted() {
        }

        @Override
        public void transportResumed() {
        }
    });
    transport.start();
    this.failoverTransport = transport.narrow(FailoverTransport.class);
    return transport;
}
Also used : TransportListener(org.apache.activemq.transport.TransportListener) IOException(java.io.IOException) Transport(org.apache.activemq.transport.Transport) URI(java.net.URI)

Example 10 with Transport

use of org.apache.activemq.transport.Transport in project activemq-artemis by apache.

the class TcpTransportServerTest method hasTransportLogger.

private boolean hasTransportLogger(Transport transport) {
    boolean end = false;
    Transport current = transport;
    while (!end) {
        if (current instanceof TransportFilter) {
            TransportFilter filter = (TransportFilter) current;
            if (filter instanceof TransportLogger) {
                return true;
            }
            current = filter.getNext();
        } else {
            end = true;
        }
    }
    return false;
}
Also used : TransportLogger(org.apache.activemq.transport.TransportLogger) Transport(org.apache.activemq.transport.Transport) TransportFilter(org.apache.activemq.transport.TransportFilter)

Aggregations

Transport (org.apache.activemq.transport.Transport)31 StubConnection (org.apache.activemq.broker.StubConnection)16 URI (java.net.URI)12 IOException (java.io.IOException)5 ActiveMQConnection (org.apache.activemq.ActiveMQConnection)5 TransportListener (org.apache.activemq.transport.TransportListener)5 FailoverTransport (org.apache.activemq.transport.failover.FailoverTransport)5 ActiveMQSessionGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.ActiveMQSessionGetter)3 SocketGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.SocketGetter)3 URISyntaxException (java.net.URISyntaxException)3 ActiveMQSession (org.apache.activemq.ActiveMQSession)3 ActiveMQDestination (org.apache.activemq.command.ActiveMQDestination)3 TransportAcceptListener (org.apache.activemq.transport.TransportAcceptListener)3 MockTransport (org.apache.activemq.transport.mock.MockTransport)3 TransportGetter (com.navercorp.pinpoint.plugin.activemq.client.field.getter.TransportGetter)2 Socket (java.net.Socket)2 JMSException (javax.jms.JMSException)2 ActiveMQMessage (org.apache.activemq.command.ActiveMQMessage)2 MessageDispatch (org.apache.activemq.command.MessageDispatch)2 File (java.io.File)1