Java Code Examples for org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer#configure()

The following examples show how to use org.springframework.boot.autoconfigure.jms.DefaultJmsListenerContainerFactoryConfigurer#configure() . 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: JMSConfig.java    From ElementVueSpringbootCodeTemplate with Apache License 2.0 6 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.

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

	return factory;
}
 
Example 2
Source File: JMSSpringConfiguration.java    From promregator with 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 File: SecKillEventConfig.java    From seckill with 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 File: BootStrap.java    From MyBlog with 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 File: BootStrap.java    From MyBlog with 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 File: JmsTest.java    From java-spring-cloud with 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 File: JmsArtemisStarterTest.java    From java-spring-cloud with 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
Source File: DittoAzureServiceBusExampleApplication.java    From ditto-examples with Eclipse Public License 2.0 5 votes vote down vote up
@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 File: ActivemqConfiguration.java    From onetwo with 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 File: ActivemqConfiguration.java    From onetwo with 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 File: JMSApplicationConfig.java    From POC with 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 File: SpringJMSITest.java    From java-specialagent with 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 File: JmsMessageBrokerConfiguration.java    From piper with 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;
}