org.springframework.jms.config.DefaultJmsListenerContainerFactory Java Examples

The following examples show how to use org.springframework.jms.config.DefaultJmsListenerContainerFactory. 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: ServiceSpringModuleConfig.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Gets a JMS listener container factory that returns a JMS listener container for the storage policy processor JMS message listener service.
 *
 * @param jmsConnectionFactory the JMS connection factory
 *
 * @return the JMS listener container factory
 */
@Bean
public DefaultJmsListenerContainerFactory storagePolicyProcessorJmsListenerContainerFactory(ConnectionFactory jmsConnectionFactory)
{
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(jmsConnectionFactory);
    factory.setDestinationResolver(herdDestinationResolver);
    factory.setConcurrency(configurationHelper.getProperty(ConfigurationValue.STORAGE_POLICY_PROCESSOR_JMS_LISTENER_POOL_CONCURRENCY_LIMITS));

    return factory;
}
 
Example #2
Source File: ServiceSpringModuleConfig.java    From herd with Apache License 2.0 6 votes vote down vote up
/**
 * Gets a JMS listener container factory that can return a JMS listener container.
 *
 * @param jmsConnectionFactory the JMS connection factory
 *
 * @return the JMS listener container factory
 */
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(ConnectionFactory jmsConnectionFactory)
{
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(jmsConnectionFactory);
    factory.setDestinationResolver(herdDestinationResolver);
    factory.setConcurrency(configurationHelper.getProperty(ConfigurationValue.JMS_LISTENER_POOL_CONCURRENCY_LIMITS));

    return factory;
}
 
Example #3
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 #4
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 #5
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 #6
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 #7
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory orderDefaultJmsListenerContainerFactory() {
  DefaultJmsListenerContainerFactory factory =
      new DefaultJmsListenerContainerFactory();
  factory
      .setConnectionFactory(receiverActiveMQConnectionFactory());
  factory.setConcurrency("3-10");

  return factory;
}
 
Example #8
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
  DefaultJmsListenerContainerFactory factory =
      new DefaultJmsListenerContainerFactory();
  factory
      .setConnectionFactory(receiverActiveMQConnectionFactory());
  factory.setPubSubDomain(true);

  return factory;
}
 
Example #9
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
  DefaultJmsListenerContainerFactory factory =
      new DefaultJmsListenerContainerFactory();
  factory
      .setConnectionFactory(receiverActiveMQConnectionFactory());
  factory.setConcurrency("3-10");

  return factory;
}
 
Example #10
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
  DefaultJmsListenerContainerFactory factory =
      new DefaultJmsListenerContainerFactory();
  factory
      .setConnectionFactory(receiverActiveMQConnectionFactory());

  return factory;
}
 
Example #11
Source File: ReceiverConfig.java    From spring-jms with MIT License 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory() {
  DefaultJmsListenerContainerFactory factory =
      new DefaultJmsListenerContainerFactory();
  factory
      .setConnectionFactory(receiverActiveMQConnectionFactory());
  factory.setConcurrency("3-10");

  return factory;
}
 
Example #12
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 #13
Source File: JmsMessageBrokerConfiguration.java    From piper with Apache License 2.0 5 votes vote down vote up
private DefaultJmsListenerContainerFactory createContainerFactory (int aConcurrency) {
  DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
  factory.setConcurrency(String.valueOf(aConcurrency));
  factory.setConnectionFactory(connectionFactory);
  return factory;
}
 
Example #14
Source File: EventRegistryJmsConfiguration.java    From flowable-engine with Apache License 2.0 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory(ConnectionFactory connectionFactory) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);

    // configuration properties are Spring Boot defaults
    factory.setPubSubDomain(false);
    factory.setSessionTransacted(true);
    factory.setAutoStartup(true);
    factory.setReceiveTimeout(Duration.ofSeconds(1).toMillis());

    return factory;
}
 
Example #15
Source File: ArtemisConfig.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Bean // configured for topics
public DefaultJmsListenerContainerFactory jmsListenerContainerFactory( ConnectionFactory connectionFactory, NameDestinationResolver nameDestinationResolver )
{
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory( connectionFactory );
    factory.setDestinationResolver( nameDestinationResolver );
    // set to true, since we only use topics and we want to resolve names to topic destination
    factory.setPubSubDomain( true );
    // 1 forces the listener to use only one consumer, to avoid duplicated messages
    factory.setConcurrency( "1" );

    return factory;
}
 
Example #16
Source File: ArtemisConfig.java    From dhis2-core with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Bean // configured for queues
public DefaultJmsListenerContainerFactory jmsQueueListenerContainerFactory( ConnectionFactory connectionFactory, NameDestinationResolver nameDestinationResolver )
{
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory( connectionFactory );
    factory.setDestinationResolver( nameDestinationResolver );
    factory.setPubSubDomain( false );
    factory.setConcurrency( "5-10" );

    return factory;
}
 
Example #17
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 #18
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 #19
Source File: ActivemqConfiguration.java    From jim-framework with Apache License 2.0 5 votes vote down vote up
public JmsListenerContainerFactory<?> jmsListenerBContainerQueue() {
    DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
    ActiveMQConnectionFactory connectionFactory=new ActiveMQConnectionFactory(Constans.CONSUMER_B_BROKER_URL);
    //connectionFactory
    bean.setConnectionFactory(connectionFactory);
    bean.setConcurrency("3-10");

    return bean;
}
 
Example #20
Source File: ActiveMQConfig.java    From hdw-dubbo with Apache License 2.0 5 votes vote down vote up
@Bean(name = "topicJmsListenerContainerFactory")
public JmsListenerContainerFactory<?> topicJmsListenerContainerFactory() {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setPubSubDomain(true);
    factory.setConnectionFactory(cachingConnectionFactory());
    return factory;
}
 
Example #21
Source File: ActiveMQConfig.java    From hdw-dubbo with Apache License 2.0 5 votes vote down vote up
@Bean(name = "queueJmsListenerContainerFactory")
public JmsListenerContainerFactory<?> queueJmsListenerContainerFactory() {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setPubSubDomain(false);
    factory.setConnectionFactory(cachingConnectionFactory());
    return factory;
}
 
Example #22
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 #23
Source File: ConsumerConfiguration.java    From solace-jms-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory cFactory(ConnectionFactory connectionFactory, DemoErrorHandler errorHandler) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory(connectionFactory);
    factory.setErrorHandler(errorHandler);
    return factory;
}
 
Example #24
Source File: JndiConsumerConfiguration.java    From solace-jms-spring-boot with Apache License 2.0 5 votes vote down vote up
@Bean
public DefaultJmsListenerContainerFactory cFactory(DemoErrorHandler errorHandler) {
    DefaultJmsListenerContainerFactory factory = new DefaultJmsListenerContainerFactory();
    factory.setConnectionFactory((ConnectionFactory) consumerConnectionFactory().getObject());
    factory.setDestinationResolver(consumerJndiDestinationResolver());
    factory.setErrorHandler(errorHandler);
    factory.setConcurrency("3-10");
   return factory;
}
 
Example #25
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 #26
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 #27
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 #28
Source File: JmsConfig.java    From myth with Apache License 2.0 5 votes vote down vote up
/**
 * Jms listener container queue jms listener container factory.
 *
 * @param activeMQConnectionFactory the active mq connection factory
 * @return the jms listener container factory
 */
@Bean(name = "queueListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.activemq", name = "broker-url")
public JmsListenerContainerFactory<?> jmsListenerContainerQueue(ConnectionFactory activeMQConnectionFactory) {
    DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
    bean.setConnectionFactory(activeMQConnectionFactory);
    bean.setPubSubDomain(Boolean.FALSE);
    return bean;
}
 
Example #29
Source File: JmsConfig.java    From myth with Apache License 2.0 5 votes vote down vote up
/**
 * Jms listener container queue jms listener container factory.
 *
 * @param activeMQConnectionFactory the active mq connection factory
 * @return the jms listener container factory
 */
@Bean(name = "queueListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.activemq", name = "broker-url")
public JmsListenerContainerFactory<?> jmsListenerContainerQueue(ConnectionFactory activeMQConnectionFactory) {
    DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
    bean.setConnectionFactory(activeMQConnectionFactory);
    bean.setPubSubDomain(Boolean.FALSE);
    return bean;
}
 
Example #30
Source File: JmsConfig.java    From myth with Apache License 2.0 5 votes vote down vote up
@Bean(name = "queueListenerContainerFactory")
@ConditionalOnProperty(prefix = "spring.activemq", name = "broker-url")
public JmsListenerContainerFactory<?> jmsListenerContainerQueue(ConnectionFactory activeMQConnectionFactory) {
    DefaultJmsListenerContainerFactory bean = new DefaultJmsListenerContainerFactory();
    bean.setConnectionFactory(activeMQConnectionFactory);
    bean.setPubSubDomain(Boolean.FALSE);
    return bean;
}