Search in sources :

Example 1 with ActiveMQManagedConnection

use of org.apache.activemq.ra.ActiveMQManagedConnection in project tomee by apache.

the class ActiveMQResourceAdapter method getActiveMQConnection.

private ActiveMQConnection getActiveMQConnection(MessageActivationSpec activationSpec, InvocationHandler invocationHandler) {
    if (AutoConnectionTracker.ConnectionInvocationHandler.class.isInstance(invocationHandler)) {
        final Object handle = Reflections.get(invocationHandler, "handle");
        if (TomEEManagedConnectionProxy.class.isInstance(handle)) {
            final ActiveMQManagedConnection c = ActiveMQManagedConnection.class.cast(Reflections.get(handle, "connection"));
            final ActiveMQConnection physicalConnection = ActiveMQConnection.class.cast(Reflections.get(c, "physicalConnection"));
            final RedeliveryPolicy redeliveryPolicy = activationSpec.redeliveryPolicy();
            if (redeliveryPolicy != null) {
                physicalConnection.setRedeliveryPolicy(redeliveryPolicy);
            }
            return physicalConnection;
        }
    }
    return null;
}
Also used : ActiveMQManagedConnection(org.apache.activemq.ra.ActiveMQManagedConnection) ActiveMQConnection(org.apache.activemq.ActiveMQConnection) RedeliveryPolicy(org.apache.activemq.RedeliveryPolicy) AutoConnectionTracker(org.apache.openejb.resource.AutoConnectionTracker)

Aggregations

ActiveMQConnection (org.apache.activemq.ActiveMQConnection)1 RedeliveryPolicy (org.apache.activemq.RedeliveryPolicy)1 ActiveMQManagedConnection (org.apache.activemq.ra.ActiveMQManagedConnection)1 AutoConnectionTracker (org.apache.openejb.resource.AutoConnectionTracker)1