Java Code Examples for org.springframework.jms.connection.CachingConnectionFactory#setSessionCacheSize()
The following examples show how to use
org.springframework.jms.connection.CachingConnectionFactory#setSessionCacheSize() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MQConnectionFactoryConfiguration.java From mq-jms-spring with Apache License 2.0 | 8 votes |
@Bean @ConditionalOnProperty(prefix = "spring.jms.cache", name = "enabled", havingValue = "true", matchIfMissing = true) public CachingConnectionFactory cachingJmsConnectionFactory(MQConfigurationProperties properties, ObjectProvider<List<MQConnectionFactoryCustomizer>> factoryCustomizers, JmsProperties jmsProperties) { JmsProperties.Cache cacheProperties = jmsProperties.getCache(); MQConnectionFactory wrappedConnectionFactory = createConnectionFactory(properties, factoryCustomizers); CachingConnectionFactory connectionFactory = new CachingConnectionFactory(wrappedConnectionFactory); connectionFactory.setCacheConsumers(cacheProperties.isConsumers()); connectionFactory.setCacheProducers(cacheProperties.isProducers()); connectionFactory.setSessionCacheSize(cacheProperties.getSessionCacheSize()); return connectionFactory; }
Example 2
Source File: EventRegistryJmsConfiguration.java From flowable-engine with Apache License 2.0 | 5 votes |
@Bean public CachingConnectionFactory cachingJmsConnectionFactory() { // configuration properties are Spring Boot defaults ActiveMQConnectionFactory activeMQConnectionFactory = new ActiveMQConnectionFactory("vm://localhost?broker.persistent=false"); activeMQConnectionFactory.setCloseTimeout((int) Duration.ofSeconds(15).toMillis()); activeMQConnectionFactory.setNonBlockingRedelivery(false); activeMQConnectionFactory.setSendTimeout(0); // wait forever CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(activeMQConnectionFactory); cachingConnectionFactory.setCacheConsumers(false); cachingConnectionFactory.setCacheProducers(true); cachingConnectionFactory.setSessionCacheSize(1); return cachingConnectionFactory; }
Example 3
Source File: MQHierachy.java From Thunder with Apache License 2.0 | 5 votes |
private void initializeCachingConnectionFactory() throws Exception { int sessionCacheSize = mqPropertyEntity.getInteger(ThunderConstant.MQ_SESSION_CACHE_SIZE_ATTRIBUTE_NAME); boolean cacheConsumers = mqPropertyEntity.getBoolean(ThunderConstant.MQ_CACHE_CONSUMERS_ATTRIBUTE_NAME); boolean cacheProducers = mqPropertyEntity.getBoolean(ThunderConstant.MQ_CACHE_PRODUCERS_ATTRIBUTE_NAME); boolean reconnectOnException = mqPropertyEntity.getBoolean(ThunderConstant.MQ_RECONNECT_ON_EXCEPTION_ATTRIBUTE_NAME); CachingConnectionFactory cachingConnectionFactory = new CachingConnectionFactory(); cachingConnectionFactory.setSessionCacheSize(sessionCacheSize); cachingConnectionFactory.setCacheConsumers(cacheConsumers); cachingConnectionFactory.setCacheProducers(cacheProducers); cachingConnectionFactory.setReconnectOnException(reconnectOnException); connectionFactory = cachingConnectionFactory; }
Example 4
Source File: JndiProducerConfiguration.java From solace-jms-spring-boot with Apache License 2.0 | 4 votes |
private CachingConnectionFactory producerCachingConnectionFactory() { CachingConnectionFactory ccf = new CachingConnectionFactory((ConnectionFactory) producerConnectionFactory().getObject()); ccf.setSessionCacheSize(10); return ccf; }
Example 5
Source File: JndiProducerConfiguration.java From solace-samples-cloudfoundry-java with Apache License 2.0 | 4 votes |
public CachingConnectionFactory cachingConnectionFactory() { CachingConnectionFactory ccf = new CachingConnectionFactory((ConnectionFactory) producerConnectionFactory().getObject()); ccf.setSessionCacheSize(10); return ccf; }