Search in sources :

Example 16 with Transport

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

the class ActiveMQConnectionFactory method createActiveMQConnection.

protected ActiveMQConnection createActiveMQConnection(String userName, String password) throws JMSException {
    if (brokerURL == null) {
        throw new ConfigurationException("brokerURL not set.");
    }
    ActiveMQConnection connection = null;
    try {
        Transport transport = createTransport();
        connection = createActiveMQConnection(transport, factoryStats);
        connection.setUserName(userName);
        connection.setPassword(password);
        configureConnection(connection);
        transport.start();
        if (clientID != null) {
            connection.setDefaultClientID(clientID);
        }
        return connection;
    } catch (JMSException e) {
        // Clean up!
        try {
            connection.close();
        } catch (Throwable ignore) {
        }
        throw e;
    } catch (Exception e) {
        // Clean up!
        try {
            connection.close();
        } catch (Throwable ignore) {
        }
        throw JMSExceptionSupport.create("Could not connect to broker URL: " + brokerURL + ". Reason: " + e, e);
    }
}
Also used : JMSException(javax.jms.JMSException) Transport(org.apache.activemq.transport.Transport) URISyntaxException(java.net.URISyntaxException) JMSException(javax.jms.JMSException)

Example 17 with Transport

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

the class NetworkTestSupport method createRemoteConnection.

protected StubConnection createRemoteConnection() throws Exception {
    Transport transport = TransportFactory.connect(remoteConnector.getServer().getConnectURI());
    StubConnection connection = new StubConnection(transport);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport)

Example 18 with Transport

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

the class NetworkTestSupport method createConnection.

@Override
protected StubConnection createConnection() throws Exception {
    Transport transport = TransportFactory.connect(connector.getServer().getConnectURI());
    StubConnection connection = new StubConnection(transport);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport)

Example 19 with Transport

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

the class BrokerNetworkWithStuckMessagesTest method createSecondRemoteConnection.

protected StubConnection createSecondRemoteConnection() throws Exception {
    Transport transport = TransportFactory.connect(secondRemoteConnector.getServer().getConnectURI());
    StubConnection connection = new StubConnection(transport);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport)

Example 20 with Transport

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

the class BrokerNetworkWithStuckMessagesTest method createConnection.

protected StubConnection createConnection() throws Exception {
    Transport transport = TransportFactory.connect(connector.getServer().getConnectURI());
    StubConnection connection = new StubConnection(transport);
    connections.add(connection);
    return connection;
}
Also used : StubConnection(org.apache.activemq.broker.StubConnection) Transport(org.apache.activemq.transport.Transport)

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