Java Code Examples for org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer

The following examples show how to use org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer. These examples are extracted from open source projects. 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
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
		DefaultJmsListenerContainerFactoryConfigurer configurer) {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	// This provides all boot's default to this factory, including the message
	// converter
	configurer.configure(factory, connectionFactory);

	// You could still override some of Boot's default if necessary.

	// 设置连接数
	factory.setConcurrency("3-10");
	// 重连间隔时间
	factory.setRecoveryInterval(1000L);

	return factory;
}
 
Example 2
Source Project: promregator   Source File: JMSSpringConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> jmsListenerContainerFactory(ConnectionFactory connectionFactory,
		DefaultJmsListenerContainerFactoryConfigurer configurer) {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	configurer.configure(factory, connectionFactory);
	return factory;
}
 
Example 3
Source Project: seckill   Source File: SecKillEventConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
JmsListenerContainerFactory<?> containerFactory(ConnectionFactory connectionFactory,
    DefaultJmsListenerContainerFactoryConfigurer configurer) {
  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  configurer.configure(factory, connectionFactory);
  return factory;
}
 
Example 4
Source Project: MyBlog   Source File: BootStrap.java    License: Apache License 2.0 5 votes vote down vote up
/*********************************************************************************************************/
//activemq的queue和topic要使用不同的factory,JmsAnnotationDrivenConfiguration会根据
//@ConditionalOnMissingBean(name = "jmsListenerContainerFactory")创建默认的factory
//所以自己创建的factory指定名字为jmsListenerContainerFactory,不用默认的
@Bean({"jmsListenerContainerFactory", "queueFactory"})
public DefaultJmsListenerContainerFactory queueFactory(
        DefaultJmsListenerContainerFactoryConfigurer configurer,
        ConnectionFactory connectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    configurer.configure(factory, connectionFactory);
    return factory;
}
 
Example 5
Source Project: MyBlog   Source File: BootStrap.java    License: Apache License 2.0 5 votes vote down vote up
@Bean("topicFactory")
public DefaultJmsListenerContainerFactory topicFactory(
        DefaultJmsListenerContainerFactoryConfigurer configurer,
        ConnectionFactory connectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    configurer.configure(factory, connectionFactory);
    factory.setPubSubDomain(true);
    return factory;
}
 
Example 6
Source Project: java-spring-cloud   Source File: JmsTest.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
    DefaultJmsListenerContainerFactoryConfigurer configurer) {
  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  // This provides all boot's default to this factory, including the message converter
  configurer.configure(factory, connectionFactory);
  // You could still override some of Boot's default if necessary.
  return factory;
}
 
Example 7
Source Project: java-spring-cloud   Source File: JmsArtemisStarterTest.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
    DefaultJmsListenerContainerFactoryConfigurer configurer) {
  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  // This provides all boot's default to this factory, including the message converter
  configurer.configure(factory, connectionFactory);
  // You could still override some of Boot's default if necessary.
  return factory;
}
 
Example 8
@Bean
public JmsListenerContainerFactory<?> myFactory(final ConnectionFactory connectionFactory,
    final DefaultJmsListenerContainerFactoryConfigurer configurer) {
  final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();

  // anonymous class
  factory.setErrorHandler(t -> LOG.error("An error has occurred in the transaction", t));

  configurer.configure(factory, connectionFactory);
  factory.setSessionTransacted(false);
  return factory;
}
 
Example 9
Source Project: onetwo   Source File: ActivemqConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name=ContainerFactorys.QUEUE)
public DefaultJmsListenerContainerFactory queueListenerContainerFactory(
		DefaultJmsListenerContainerFactoryConfigurer configurer,
		ConnectionFactory connectionFactory) {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	configurer.configure(factory, connectionFactory);
	factory.setPubSubDomain(false);
	return factory;
}
 
Example 10
Source Project: onetwo   Source File: ActivemqConfiguration.java    License: Apache License 2.0 5 votes vote down vote up
@Bean(name=ContainerFactorys.TOPIC)
public DefaultJmsListenerContainerFactory topicListenerContainerFactory(
		DefaultJmsListenerContainerFactoryConfigurer configurer,
		ConnectionFactory connectionFactory) {
	DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	configurer.configure(factory, connectionFactory);
	factory.setPubSubDomain(true);
	return factory;
}
 
Example 11
Source Project: POC   Source File: JMSApplicationConfig.java    License: Apache License 2.0 5 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> myFactory(ConnectionFactory connectionFactory,
		DefaultJmsListenerContainerFactoryConfigurer configurer) {
	final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
	// This provides all boot's default to this factory, including the message
	// converter
	configurer.configure(factory, connectionFactory);
	// You could still override some of Boot's default if necessary.
	return factory;
}
 
Example 12
Source Project: java-specialagent   Source File: SpringJMSITest.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> myFactory(final DefaultJmsListenerContainerFactoryConfigurer configurer) {
  final DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  configurer.configure(factory, connectionFactory());
  return factory;
}
 
Example 13
Source Project: piper   Source File: JmsMessageBrokerConfiguration.java    License: Apache License 2.0 4 votes vote down vote up
@Bean
public JmsListenerContainerFactory<?> jmsListenerContainerFactory(ConnectionFactory connectionFactory, DefaultJmsListenerContainerFactoryConfigurer configurer) {
  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  configurer.configure(factory, connectionFactory);
  return factory;
}