本文整理匯總了Java中org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.setQueues方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleMessageListenerContainer.setQueues方法的具體用法?Java SimpleMessageListenerContainer.setQueues怎麽用?Java SimpleMessageListenerContainer.setQueues使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer
的用法示例。
在下文中一共展示了SimpleMessageListenerContainer.setQueues方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: messageContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "host")
public SimpleMessageListenerContainer messageContainer() {
SimpleMessageListenerContainer container =
new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(queue());
container.setExposeListenerChannel(true);
container.setMaxConcurrentConsumers(2);
container.setConcurrentConsumers(1);
//設置確認模式手工確認
container.setAcknowledgeMode(AcknowledgeMode.MANUAL);
container.setMessageListener((ChannelAwareMessageListener) (message, channel) -> {
byte[] messageBody = message.getBody();
LOGGER.debug("motan 框架接收到的消息");
//確認消息成功消費
final Boolean success = mythMqReceiveService.processMessage(messageBody);
if (success) {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
});
return container;
}
示例2: messageContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "host")
public SimpleMessageListenerContainer messageContainer() {
SimpleMessageListenerContainer container =
new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(queue());
container.setExposeListenerChannel(true);
container.setMaxConcurrentConsumers(1);
container.setConcurrentConsumers(1);
//設置確認模式手工確認
container.setAcknowledgeMode(AcknowledgeMode.MANUAL);
container.setMessageListener((ChannelAwareMessageListener) (message, channel) -> {
byte[] messageBody = message.getBody();
//確認消息成功消費
final Boolean success = mythMqReceiveService.processMessage(messageBody);
if (success) {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
});
return container;
}
示例3: messageContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
@ConditionalOnProperty(prefix = "spring.rabbitmq", name = "host")
public SimpleMessageListenerContainer messageContainer() {
SimpleMessageListenerContainer container =
new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(queue());
container.setExposeListenerChannel(true);
container.setMaxConcurrentConsumers(3);
container.setConcurrentConsumers(1);
//設置確認模式手工確認
container.setAcknowledgeMode(AcknowledgeMode.MANUAL);
container.setMessageListener((ChannelAwareMessageListener) (message, channel) -> {
byte[] messageBody = message.getBody();
LogUtil.debug(LOGGER,()->"springcloud account服務 amqp接收消息");
//確認消息成功消費
final Boolean success = mythMqReceiveService.processMessage(messageBody);
if (success) {
channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
}
});
return container;
}
示例4: serviceListenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
SimpleMessageListenerContainer serviceListenerContainer(
LeadProcessor leadProcessor, @Qualifier(REQUEST_Q) Queue queue,
LeadGeocodingProcessor leadGeocodingProcessor,
JdbcTemplate jdbcTemplate, ConnectionFactory rabbitConnectionFactory) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
BatchProcessor[] leadProcessors = new BatchProcessor[]{leadProcessor, leadGeocodingProcessor};
PojoListener pojoListener = new PojoListener(jdbcTemplate, leadProcessors);
SimpleMessageConverter simpleMessageConverter = new NoOpSimpleMessageConverter();
container.setMessageListener(new MessageListenerAdapter(pojoListener, simpleMessageConverter));
container.setConnectionFactory(rabbitConnectionFactory);
container.setQueues(queue);
return container;
}
示例5: ticketingServiceListenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
* This bean instantiates and returns the Simple message
* listener container.
*
* @return Simple message listener container
*/
@Bean
SimpleMessageListenerContainer ticketingServiceListenerContainer()
{
final SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(rabbitConnectionFactory);
container.setAcknowledgeMode(AcknowledgeMode.AUTO);
container.setQueues(ticketServiceRequestQueue);
container.setMessageListener(ticketingServiceListener());
container.setErrorHandler(new DefaultContainerErrorHandler("ticketingServiceListenerContainer"));
return container;
}
開發者ID:dellemc-symphony,項目名稱:ticketing-service-paqx-parent-sample,代碼行數:18,代碼來源:TicketingServiceConsumerConfig.java
示例6: messageContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer messageContainer(ConnectionFactory connectionFactory, MessageListenerAdapter messageListenerAdapter) {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(this.queue);
container.setExposeListenerChannel(true);
container.setMaxConcurrentConsumers(this.maxConcurrentConsumers);
container.setConcurrentConsumers(this.concurrentConsumers);
container.setAcknowledgeMode(AcknowledgeMode.AUTO);
container.setMessageListener(messageListenerAdapter);
return container;
}
示例7: getMessageListenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer getMessageListenerContainer(final ConnectionFactory connectionFactory,
final Queue commandDrainQueue,
final MessageListenerAdapter messageListener) {
final SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(commandDrainQueue);
container.setMessageListener(messageListener);
return container;
}
示例8: listenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer bean = new SimpleMessageListenerContainer(connectionFactory());
bean.setMessageListener(messageListener);
bean.setQueues(queue());
bean.setAcknowledgeMode(AcknowledgeMode.AUTO);
return bean;
}
示例9: createMessageListenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
public SimpleMessageListenerContainer createMessageListenerContainer(MessageListenerAdapter messageListener, Queue... queuesToListenOn) {
validateInput(messageListener, queuesToListenOn);
SimpleMessageListenerContainer simpleMessageListenerContainer = new SimpleMessageListenerContainer(connectionFactory);
simpleMessageListenerContainer.setQueues(queuesToListenOn);
simpleMessageListenerContainer.setMessageListener(messageListener);
simpleMessageListenerContainer.setConcurrentConsumers(messagingConfiguration.getConcurrentConsumers());
return simpleMessageListenerContainer;
}
開發者ID:zeroDivisible,項目名稱:spring-rabbitmq-example,代碼行數:11,代碼來源:SimpleMessageListenerContainerFactory.java
示例10: controlContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
* SimpleMessageListenerContainerのインスタンスをDIコンテナに登録します。
* @return SimpleMessageListenerContainerのインスタンス
*/
@Bean
public SimpleMessageListenerContainer controlContainer() {
SimpleMessageListenerContainer container = makeContainer();
container.setQueues(resourceConsumerQueue());
container.setMessageListener(consumerAdapter());
container.setConcurrentConsumers(10);
return container;
}
示例11: keypairControlContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
* SimpleMessageListenerContainerのインスタンスをDIコンテナに登録します。
* @return SimpleMessageListenerContainerのインスタンス
*/
@Bean
public SimpleMessageListenerContainer keypairControlContainer() {
SimpleMessageListenerContainer container = makeContainer();
container.setQueues(keypairConsumerQueue());
container.setMessageListener(keypairConsumerAdapter());
return container;
}
示例12: networkControlContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
* SimpleMessageListenerContainerのインスタンスをDIコンテナに登録します。
* @return SimpleMessageListenerContainerのインスタンス
*/
@Bean
public SimpleMessageListenerContainer networkControlContainer() {
SimpleMessageListenerContainer container = makeContainer();
container.setQueues(networkConsumerQueue());
container.setMessageListener(networkConsumerAdapter());
return container;
}
示例13: simpleMessageListenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean(destroyMethod = "destroy")
public SimpleMessageListenerContainer simpleMessageListenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
container.setQueues(queue());
container.setMessageListener(loggingMessageListenerAdapter());
container.setAcknowledgeMode(AcknowledgeMode.AUTO);
return container;
}
示例14: listenerContainer
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer listenerContainer() {
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConcurrentConsumers(5);
container.setConnectionFactory(connectionFactory());
container.setQueues(responseQueue());
container.setMessageListener(rabbitTemplate());
return container;
}