org.springframework.boot.autoconfigure.jms.JmsProperties Java Examples

The following examples show how to use org.springframework.boot.autoconfigure.jms.JmsProperties. 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 vote down vote up
@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;
}