Search in sources :

Example 1 with ManagedConnection

use of com.axway.ats.action.jms.model.connections.ManagedConnection in project ats-framework by Axway.

the class JmsClient method shutdown.

/**
     * Shutdown the JMS client.
     * This closes all connections and sessions.
     */
@PublicAtsApi
public synchronized void shutdown() {
    releaseSession(true);
    releaseConnection();
    for (final ManagedConnection connection : connections) {
        connection.shutdown();
    }
    connections.clear();
}
Also used : ManagedConnection(com.axway.ats.action.jms.model.connections.ManagedConnection) PublicAtsApi(com.axway.ats.common.PublicAtsApi)

Example 2 with ManagedConnection

use of com.axway.ats.action.jms.model.connections.ManagedConnection in project ats-framework by Axway.

the class JmsClient method doConnect.

private synchronized ManagedConnection doConnect() {
    releaseConnection();
    final ManagedConnection connection = createManagedConnection();
    try {
        connection.start();
    } catch (JMSException e) {
        connection.shutdown();
        throw new JmsMessageException("Error starting JMS connection from connection factory '" + defaultConnectionFactoryName + "'", e);
    }
    this.connection = connection;
    return connection;
}
Also used : JmsMessageException(com.axway.ats.action.exceptions.JmsMessageException) ManagedConnection(com.axway.ats.action.jms.model.connections.ManagedConnection) JMSException(javax.jms.JMSException)

Example 3 with ManagedConnection

use of com.axway.ats.action.jms.model.connections.ManagedConnection in project ats-framework by Axway.

the class JmsClient method createManagedConnection.

private ManagedConnection createManagedConnection() {
    final ManagedConnection connection;
    final ConnectionFactory connectionFactory = getConnectionFactory();
    try {
        if (!StringUtils.isNullOrEmpty(this.username)) {
            connection = ManagedConnection.create(connectionFactory.createConnection(this.username, this.password));
        } else {
            connection = ManagedConnection.create(connectionFactory.createConnection());
        }
    } catch (JMSException e) {
        throw new JmsMessageException("Error creating JMS connection from connection factory '" + defaultConnectionFactoryName + "'", e);
    }
    return connection;
}
Also used : JmsMessageException(com.axway.ats.action.exceptions.JmsMessageException) ConnectionFactory(javax.jms.ConnectionFactory) ManagedConnection(com.axway.ats.action.jms.model.connections.ManagedConnection) JMSException(javax.jms.JMSException)

Aggregations

ManagedConnection (com.axway.ats.action.jms.model.connections.ManagedConnection)3 JmsMessageException (com.axway.ats.action.exceptions.JmsMessageException)2 JMSException (javax.jms.JMSException)2 PublicAtsApi (com.axway.ats.common.PublicAtsApi)1 ConnectionFactory (javax.jms.ConnectionFactory)1