当前位置: 首页>>代码示例>>Java>>正文


Java SimpleRabbitListenerContainerFactory.setTxSize方法代码示例

本文整理汇总了Java中org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory.setTxSize方法的典型用法代码示例。如果您正苦于以下问题:Java SimpleRabbitListenerContainerFactory.setTxSize方法的具体用法?Java SimpleRabbitListenerContainerFactory.setTxSize怎么用?Java SimpleRabbitListenerContainerFactory.setTxSize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory的用法示例。


在下文中一共展示了SimpleRabbitListenerContainerFactory.setTxSize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: rabbitListenerContainerFactory

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; //导入方法依赖的package包/类
@Bean
@ConditionalOnMissingBean(name = "rabbitListenerContainerFactory")
public SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory(
		ConnectionFactory connectionFactory, RabbitProperties config) {
	SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory();
	factory.setConnectionFactory(connectionFactory);
	Listener listenerConfig = config.getListener();
	factory.setAutoStartup(listenerConfig.isAutoStartup());
	if (listenerConfig.getAcknowledgeMode() != null) {
		factory.setAcknowledgeMode(listenerConfig.getAcknowledgeMode());
	}
	if (listenerConfig.getConcurrency() != null) {
		factory.setConcurrentConsumers(listenerConfig.getConcurrency());
	}
	if (listenerConfig.getMaxConcurrency() != null) {
		factory.setMaxConcurrentConsumers(listenerConfig.getMaxConcurrency());
	}
	if (listenerConfig.getPrefetch() != null) {
		factory.setPrefetchCount(listenerConfig.getPrefetch());
	}
	if (listenerConfig.getTransactionSize() != null) {
		factory.setTxSize(listenerConfig.getTransactionSize());
	}
	return factory;
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:26,代码来源:RabbitAnnotationDrivenConfiguration.java

示例2: testRabbitListenerContainerFactoryBackOff

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; //导入方法依赖的package包/类
@Test
public void testRabbitListenerContainerFactoryBackOff() {
	load(TestConfiguration5.class);
	SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = this.context
			.getBean("rabbitListenerContainerFactory",
					SimpleRabbitListenerContainerFactory.class);
	rabbitListenerContainerFactory.setTxSize(10);
	verify(rabbitListenerContainerFactory).setTxSize(10);
	DirectFieldAccessor dfa = new DirectFieldAccessor(rabbitListenerContainerFactory);
	Advice[] adviceChain = (Advice[]) dfa.getPropertyValue("adviceChain");
	assertThat(adviceChain).isNull();
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:RabbitAutoConfigurationTests.java

示例3: testRabbitListenerContainerFactoryBackOff

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; //导入方法依赖的package包/类
@Test
public void testRabbitListenerContainerFactoryBackOff() {
	load(TestConfiguration5.class);
	SimpleRabbitListenerContainerFactory rabbitListenerContainerFactory = this.context
			.getBean("rabbitListenerContainerFactory",
					SimpleRabbitListenerContainerFactory.class);
	rabbitListenerContainerFactory.setTxSize(10);
	verify(rabbitListenerContainerFactory).setTxSize(10);
}
 
开发者ID:Nephilim84,项目名称:contestparser,代码行数:10,代码来源:RabbitAutoConfigurationTests.java

示例4: configure

import org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory; //导入方法依赖的package包/类
/**
 * Configure the specified rabbit listener container factory. The factory can be
 * further tuned and default settings can be overridden.
 * @param factory the {@link SimpleRabbitListenerContainerFactory} instance to
 * configure
 * @param connectionFactory the {@link ConnectionFactory} to use
 */
public void configure(SimpleRabbitListenerContainerFactory factory,
		ConnectionFactory connectionFactory) {
	Assert.notNull(factory, "Factory must not be null");
	Assert.notNull(connectionFactory, "ConnectionFactory must not be null");
	factory.setConnectionFactory(connectionFactory);
	if (this.messageConverter != null) {
		factory.setMessageConverter(this.messageConverter);
	}
	RabbitProperties.Listener listenerConfig = this.rabbitProperties.getListener();
	factory.setAutoStartup(listenerConfig.isAutoStartup());
	if (listenerConfig.getAcknowledgeMode() != null) {
		factory.setAcknowledgeMode(listenerConfig.getAcknowledgeMode());
	}
	if (listenerConfig.getConcurrency() != null) {
		factory.setConcurrentConsumers(listenerConfig.getConcurrency());
	}
	if (listenerConfig.getMaxConcurrency() != null) {
		factory.setMaxConcurrentConsumers(listenerConfig.getMaxConcurrency());
	}
	if (listenerConfig.getPrefetch() != null) {
		factory.setPrefetchCount(listenerConfig.getPrefetch());
	}
	if (listenerConfig.getTransactionSize() != null) {
		factory.setTxSize(listenerConfig.getTransactionSize());
	}
	if (listenerConfig.getDefaultRequeueRejected() != null) {
		factory.setDefaultRequeueRejected(listenerConfig.getDefaultRequeueRejected());
	}
	ListenerRetry retryConfig = listenerConfig.getRetry();
	if (retryConfig.isEnabled()) {
		RetryInterceptorBuilder<?> builder = (retryConfig.isStateless()
				? RetryInterceptorBuilder.stateless()
				: RetryInterceptorBuilder.stateful());
		builder.maxAttempts(retryConfig.getMaxAttempts());
		builder.backOffOptions(retryConfig.getInitialInterval(),
				retryConfig.getMultiplier(), retryConfig.getMaxInterval());
		builder.recoverer(new RejectAndDontRequeueRecoverer());
		factory.setAdviceChain(builder.build());
	}

}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:49,代码来源:SimpleRabbitListenerContainerFactoryConfigurer.java


注:本文中的org.springframework.amqp.rabbit.config.SimpleRabbitListenerContainerFactory.setTxSize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。