當前位置: 首頁>>代碼示例>>Java>>正文


Java SimpleMessageListenerContainer.setQueueNames方法代碼示例

本文整理匯總了Java中org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.setQueueNames方法的典型用法代碼示例。如果您正苦於以下問題:Java SimpleMessageListenerContainer.setQueueNames方法的具體用法?Java SimpleMessageListenerContainer.setQueueNames怎麽用?Java SimpleMessageListenerContainer.setQueueNames使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer的用法示例。


在下文中一共展示了SimpleMessageListenerContainer.setQueueNames方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: legacyPojoListener

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer legacyPojoListener(ConnectionFactory connectionFactory) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setQueueNames(MAPPED_QUEUE);
    MessageListenerAdapter messageListener = new MessageListenerAdapter(new Object() {

        @SuppressWarnings("unused")
        public void handleMessage(Object object) {
            System.out.println("Got a " + object);
            JsonApp.this.latch.countDown();
        }

    });
    Jackson2JsonMessageConverter jsonConverter = new Jackson2JsonMessageConverter();
    jsonConverter.setClassMapper(classMapper());
    messageListener.setMessageConverter(jsonConverter);
    container.setMessageListener(messageListener);
    return container;
}
 
開發者ID:laidu,項目名稱:java-learn,代碼行數:20,代碼來源:JsonApp.java

示例2: getSimpleMessageListenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
private SimpleMessageListenerContainer getSimpleMessageListenerContainer(
    ConnectionFactory connectionFactory,
    @Qualifier("listenerAdapter_vnfmCoreActions") MessageListenerAdapter listenerAdapter,
    String queueName_vnfmCoreActions,
    int minConcurrency,
    int maxConcurrency) {
  SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
  container.setConnectionFactory(connectionFactory);
  container.setQueueNames(queueName_vnfmCoreActions);
  if (minConcurrency <= 0 || maxConcurrency <= 0 || minConcurrency > maxConcurrency) {
    container.setConcurrentConsumers(5);
    container.setMaxConcurrentConsumers(15);
  } else {
    container.setConcurrentConsumers(minConcurrency);
    container.setMaxConcurrentConsumers(maxConcurrency);
  }
  container.setMessageListener(listenerAdapter);
  container.setErrorHandler(
      new ConditionalRejectingErrorHandler(new HandleJsonSyntaxExceptionStrategy()));
  return container;
}
 
開發者ID:openbaton,項目名稱:NFVO,代碼行數:22,代碼來源:RabbitConfiguration.java

示例3: container_logDispatcher

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
SimpleMessageListenerContainer container_logDispatcher(
    ConnectionFactory connectionFactory,
    @Qualifier("listenerAdapter_logDispatch") MessageListenerAdapter listenerAdapter) {
  if (listenerAdapter != null) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
    container.setQueueNames(queueName_logDispatch);
    if (minConcurrency <= 0 || maxConcurrency <= 0 || minConcurrency > maxConcurrency) {
      container.setConcurrentConsumers(5);
      container.setMaxConcurrentConsumers(15);
    } else {
      container.setConcurrentConsumers(minConcurrency);
      container.setMaxConcurrentConsumers(maxConcurrency);
    }
    container.setMessageListener(listenerAdapter);
    return container;
  } else return null;
}
 
開發者ID:openbaton,項目名稱:openbaton-libs,代碼行數:20,代碼來源:RabbitConfiguration.java

示例4: container_eventRegister

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
SimpleMessageListenerContainer container_eventRegister(
    ConnectionFactory connectionFactory,
    @Qualifier("listenerAdapter_nfvoGenericActions") MessageListenerAdapter listenerAdapter) {
  SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
  container.setConnectionFactory(connectionFactory);
  container.setQueueNames(queueName_nfvoGenericActions);
  if (minConcurrency <= 0 || maxConcurrency <= 0 || minConcurrency > maxConcurrency) {
    container.setConcurrentConsumers(5);
    container.setMaxConcurrentConsumers(15);
  } else {
    container.setConcurrentConsumers(minConcurrency);
    container.setMaxConcurrentConsumers(maxConcurrency);
  }
  container.setMessageListener(listenerAdapter);
  return container;
}
 
開發者ID:openbaton,項目名稱:openbaton-libs,代碼行數:18,代碼來源:RabbitConfiguration.java

示例5: subscribeQueue

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
private void subscribeQueue(MQMessageConsumer consumer) 
	throws MessageException {

       String realQName = getIpQueueName(consumer.getDestinationName());

	Integer cc = MessageConfig.current.get(Integer.class, "concurrent");
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	container.setQueueNames(realQName);
	container.setConnectionFactory(connectionFactory);
	container.setConcurrentConsumers(cc);
	
	MessageListenerAdapter apdapter = new MessageListenerAdapter(consumer);
	apdapter.setMessageConverter(this.messageConverter);
	apdapter.setDefaultListenerMethod("handleMessage");
	
	container.setMessageListener(apdapter);
	
	this.bindingQueue(consumer.getConsumerId());
	
	containerList.add(container);
}
 
開發者ID:yamingd,項目名稱:argo,代碼行數:22,代碼來源:RabbitMQServerProvider.java

示例6: messageListenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer messageListenerContainer() {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
    container.setQueueNames(queueName);
    container.setMessageListener(process);
    return container;
}
 
開發者ID:giovannicandido,項目名稱:audit-mq-collector,代碼行數:9,代碼來源:RabbitConfiguration.java

示例7: listenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer listenerContainer() {
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	container.setConnectionFactory(connectionFactory());
	container.setQueueNames(this.queueName);
	container.setMessageListener(messageListenerAdapter());

	return container;
}
 
開發者ID:microservices-demo,項目名稱:queue-master,代碼行數:10,代碼來源:ShippingConsumerConfiguration.java

示例8: registerListener

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
 * Attaches a listener to a queue to start procssing messages
 *
 * @param queueName
 * @param listener
 */
private void registerListener(String queueName, MessageListener listener) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(connectionFactory);
    container.setConnectionFactory(connectionFactory);
    container.setQueueNames(queueName);
    container.setMessageListener(listener);
    container.start();
    listeners.add(container);
    LOGGER.debug("Registered listener on queue {}", queueName);
}
 
開發者ID:Byteflair,項目名稱:resthooks,代碼行數:16,代碼來源:AmqpService.java

示例9: outMessageListenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public MessageListenerContainer outMessageListenerContainer(
        ConnectionFactory outConnectionFactory,
        MessageListener outMessageListener
) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(outConnectionFactory);
    container.setQueueNames(resultQueue);
    container.setMessageListener(outMessageListener);

    return container;
}
 
開發者ID:dvoraka,項目名稱:av-service,代碼行數:13,代碼來源:AmqpBridgeOutputConfig.java

示例10: messageListenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer messageListenerContainer(MessageListenerAdapter listenerAdapter) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory());
    container.setQueueNames(AmqpConfig.QUEUE_NAME);
    container.setExposeListenerChannel(true);
    container.setMaxConcurrentConsumers(1);
    container.setConcurrentConsumers(1);
    container.setAcknowledgeMode(AcknowledgeMode.MANUAL); //設置確認模式手工確認
    container.setMessageListener(listenerAdapter);
    return container;
}
 
開發者ID:liubo6,項目名稱:demo_springboot_rabbitmq,代碼行數:13,代碼來源:AmqpConfig.java

示例11: container_emsRegistrator

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
SimpleMessageListenerContainer container_emsRegistrator() {
  if (listenerAdapter_emsRegistrator != null) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(emsConnectionFactory);
    container.setQueueNames(queueName_emsRegistrator);
    container.setConcurrentConsumers(1);
    container.setMaxConcurrentConsumers(15);
    container.setMessageListener(listenerAdapter_emsRegistrator);
    return container;
  } else return null;
}
 
開發者ID:openbaton,項目名稱:generic-vnfm,代碼行數:13,代碼來源:EMSConfiguration.java

示例12: rabbitContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Test
public void rabbitContainer() throws Exception {
	CachingConnectionFactory bean = (CachingConnectionFactory) applicationContext
			.getBean("rabbitConnectionFactory");
	//
	String QUEUE_NAME = "TEST_BENCHMARK";
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	container.setConnectionFactory(bean);
	container.setQueueNames(QUEUE_NAME);
	container.setMessageListener(new MessageAdapter());
	//
	ThreadHelper.sleep(1 * 60 * 1000);
}
 
開發者ID:mixaceh,項目名稱:openyu-commons,代碼行數:14,代碼來源:ApplicationContextRabbitmqTest.java

示例13: listenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
public SimpleMessageListenerContainer listenerContainer() {
	SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
	container.setConnectionFactory(connectionFactory());
	container.setQueueNames(this.scrapingResultQueue);
	container.setMessageListener(messageListenerAdapter());

	return container;
}
 
開發者ID:BernhardWenzel,項目名稱:scraping-microservice-java-python-rabbitmq,代碼行數:10,代碼來源:ScrapingResultConsumerConfiguration.java

示例14: configureMessageListener

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
/**
 * Creates a new MessageListener that gets fired once a message has been received.
 * 
 * @return an instance of SimpleMessageListernerContainer
 */
private SimpleMessageListenerContainer configureMessageListener()
{
  SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
  container.setConnectionFactory(this.objConnection);
  container.setQueueNames(this.objQueue.getName());
  container.setMessageListener(this);
  container.afterPropertiesSet();
  container.start();
  return container;
}
 
開發者ID:MaxxtonGroup,項目名稱:async-amqp-messaging,代碼行數:16,代碼來源:ReceiveController.java

示例15: replyListenerContainer

import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer; //導入方法依賴的package包/類
@Bean
SimpleMessageListenerContainer replyListenerContainer(
        RabbitTemplate rabbitTemplate, ConnectionFactory connectionFactory) {
    SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
    container.setConnectionFactory(connectionFactory);
    container.setQueueNames( REPLY_Q);
    container.setMessageListener(rabbitTemplate);
    return container;
}
 
開發者ID:joshlong,項目名稱:sfdc-cloudfoundry,代碼行數:10,代碼來源:RabbitConfiguration.java


注:本文中的org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer.setQueueNames方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。