Example usage for org.springframework.jms.connection CachingConnectionFactory getTargetConnectionFactory

List of usage examples for org.springframework.jms.connection CachingConnectionFactory getTargetConnectionFactory

Introduction

In this page you can find the example usage for org.springframework.jms.connection CachingConnectionFactory getTargetConnectionFactory.

Prototype

@Nullable
public ConnectionFactory getTargetConnectionFactory() 

Source Link

Document

Return the target ConnectionFactory which will be used to lazily create a single Connection, if any.

Usage

From source file:org.powertac.samplebroker.core.JmsManagementService.java

public void init(String overridenBrokerUrl, String serverQueueName) {
    brokerPropertiesService.configureMe(this);
    this.serverQueueName = serverQueueName;
    if (overridenBrokerUrl != null && !overridenBrokerUrl.isEmpty()) {
        setJmsBrokerUrl(overridenBrokerUrl);
    }//from ww  w  .  ja  v a 2s . co  m

    ActiveMQConnectionFactory amqConnectionFactory = null;
    if (connectionFactory instanceof PooledConnectionFactory) {
        PooledConnectionFactory pooledConnectionFactory = (PooledConnectionFactory) connectionFactory;
        if (pooledConnectionFactory.getConnectionFactory() instanceof ActiveMQConnectionFactory) {
            amqConnectionFactory = (ActiveMQConnectionFactory) pooledConnectionFactory.getConnectionFactory();
        }
    } else if (connectionFactory instanceof CachingConnectionFactory) {
        CachingConnectionFactory cachingConnectionFactory = (CachingConnectionFactory) connectionFactory;
        if (cachingConnectionFactory.getTargetConnectionFactory() instanceof ActiveMQConnectionFactory) {
            amqConnectionFactory = (ActiveMQConnectionFactory) cachingConnectionFactory
                    .getTargetConnectionFactory();
        }
    }

    if (amqConnectionFactory != null) {
        amqConnectionFactory.setBrokerURL(getJmsBrokerUrl());
    }
}