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

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

Introduction

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

Prototype

public void setCacheConsumers(boolean cacheConsumers) 

Source Link

Document

Specify whether to cache JMS MessageConsumers per JMS Session instance (more specifically: one MessageConsumer per Destination, selector String and Session).

Usage

From source file:io.galeb.health.configurations.JMSConfiguration.java

@Bean(name = "connectionFactory")
public CachingConnectionFactory cachingConnectionFactory() throws JMSException {
    CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory();
    ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactory(BROKER_CONN);
    connectionFactory.setUser(BROKER_USER);
    connectionFactory.setPassword(BROKER_PASS);
    if (BROKER_HA) {
        connectionFactory.setConnectionLoadBalancingPolicyClassName(
                RoundRobinConnectionLoadBalancingPolicy.class.getName());
    }/*from   www. ja  va2s  . c  om*/
    cachingConnectionFactory.setTargetConnectionFactory(connectionFactory);
    cachingConnectionFactory.setSessionCacheSize(100);
    cachingConnectionFactory.setCacheConsumers(true);
    return cachingConnectionFactory;
}