List of usage examples for org.springframework.amqp.rabbit.listener SimpleMessageListenerContainer SimpleMessageListenerContainer
public SimpleMessageListenerContainer()
From source file:crawler.configuration.rabbitmq.RabbitMQConfiguration.java
@Bean SimpleMessageListenerContainer container(ConnectionFactory connectionFactory) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setQueueNames(htmlQueue().getName()); container.setMessageListener(this); container.setConcurrentConsumers(rabbitMQConfigurationProperties.getConcurrentConsumers()); // container.setMaxConcurrentConsumers(32); container.setPrefetchCount(rabbitMQConfigurationProperties.getPrefetchCount()); // rabbitListenerContainerFactory.setConcurrentConsumers(16); return container; }
From source file:com.sample.amqp.RabbitConfiguration.java
@Bean public SimpleMessageListenerContainer listenerContainer() { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConcurrentConsumers(5); container.setConnectionFactory(connectionFactory()); container.setQueues(responseQueue()); container.setMessageListener(rabbitTemplate()); return container; }
From source file:jp.co.ctc_g.rack.resource_manager.config.RackResourceManagerConsumerContextConfig.java
private SimpleMessageListenerContainer makeContainer() { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(factory()); container.setErrorHandler(errorHandler()); container.setAdviceChain(advice());/*from w w w. j a v a 2 s . co m*/ return container; }
From source file:org.openbaton.common.vnfm_sdk.amqp.configuration.RabbitConfiguration.java
@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 {//from ww w . j av a 2 s .c o m container.setConcurrentConsumers(minConcurrency); container.setMaxConcurrentConsumers(maxConcurrency); } container.setMessageListener(listenerAdapter); return container; } else return null; }
From source file:org.resthub.rpc.RPCEndpoint.java
/** * Starts the endpoint on the connection specified. * A listener container is launched on a created queue. The listener will * respond to hessian requests. The endpoint is closed by calling the destroy * method.//w w w . jav a 2s . c om */ public void run() { logger.debug("Launching endpoint for service : " + serviceAPI.getSimpleName()); admin = new RabbitAdmin(connectionFactory); // Add connectionListener to recreate queue when connection fall connectionFactory.addConnectionListener(new ConnectionListener() { public void onCreate(Connection connection) { createQueue(admin, getRequestQueueName(serviceAPI)); } public void onClose(Connection connection) { } }); // Create the queue normaly the first time this.createQueue(admin, getRequestQueueName(serviceAPI)); MessageListenerAdapter listenerAdapter = new MessageListenerAdapter( new RawMessageDelegate(serviceAPI, serviceImpl, serializationHandler)); listenerAdapter.setMessageConverter(null); listenerAdapter.setMandatoryPublish(false); listenerContainer = new SimpleMessageListenerContainer(); listenerContainer.setConnectionFactory(connectionFactory); listenerContainer.setQueueNames(getRequestQueueName(serviceAPI)); listenerContainer.setMessageListener(listenerAdapter); if (this.concurentConsumers > 0) { listenerContainer.setConcurrentConsumers(concurentConsumers); } listenerContainer.start(); }
From source file:org.resthub.rpc.HessianEndpoint.java
/** * Starts the endpoint on the connection specified. * A listener container is launched on a created queue. The listener will * respond to hessian requests. The endpoint is closed by calling the destroy * method.//from w w w . ja v a2 s . c o m */ public void run() { logger.debug("Launching endpoint for service : " + serviceAPI.getSimpleName()); admin = new RabbitAdmin(connectionFactory); // Add connectionListener to recreate queue when connection fall connectionFactory.addConnectionListener(new ConnectionListener() { public void onCreate(Connection connection) { createQueue(admin, getRequestQueueName(serviceAPI)); } public void onClose(Connection connection) { } }); // Create the queue normaly the first time this.createQueue(admin, getRequestQueueName(serviceAPI)); MessageListenerAdapter listenerAdapter = new MessageListenerAdapter( new RawMessageDelegate(serviceAPI, serviceImpl, serializerFactory)); listenerAdapter.setMessageConverter(null); listenerAdapter.setMandatoryPublish(false); listenerContainer = new SimpleMessageListenerContainer(); listenerContainer.setConnectionFactory(connectionFactory); listenerContainer.setQueueNames(getRequestQueueName(serviceAPI)); listenerContainer.setMessageListener(listenerAdapter); if (this.concurentConsumers > 0) { listenerContainer.setConcurrentConsumers(concurentConsumers); } listenerContainer.start(); }
From source file:org.openbaton.common.vnfm_sdk.amqp.configuration.RabbitConfiguration.java
@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 {//from w ww. j a v a2s . com container.setConcurrentConsumers(minConcurrency); container.setMaxConcurrentConsumers(maxConcurrency); } container.setMessageListener(listenerAdapter); return container; }
From source file:org.openbaton.common.vnfm_sdk.amqp.configuration.RabbitConfiguration.java
@Bean SimpleMessageListenerContainer container_emsRegistrator(ConnectionFactory connectionFactory) { if (listenerAdapter_emsRegistrator != null) { SimpleMessageListenerContainer container = new SimpleMessageListenerContainer(); container.setConnectionFactory(connectionFactory); container.setQueueNames(queueName_emsRegistrator); container.setConcurrentConsumers(1); container.setMaxConcurrentConsumers(15); container.setMessageListener(listenerAdapter_emsRegistrator); return container; } else/* w w w . j a v a2 s. c om*/ return null; }
From source file:org.openbaton.nse.api.EventReceiver.java
@Bean public SimpleMessageListenerContainer setCreationMessageContainer(ConnectionFactory connectionFactory, @Qualifier("getCreationQueue") Queue queue, @Qualifier("setCreationMessageListenerAdapter") MessageListenerAdapter adapter) { logger.debug("Created MessageContainer for NSR Creation event"); SimpleMessageListenerContainer res = new SimpleMessageListenerContainer(); res.setConnectionFactory(connectionFactory); res.setQueues(queue);/*from w ww . j a v a 2s . c om*/ res.setMessageListener(adapter); return res; }
From source file:org.openbaton.nse.api.EventReceiver.java
@Bean public SimpleMessageListenerContainer setErrorMessageContainer(ConnectionFactory connectionFactory, @Qualifier("getErrorQueue") Queue queue, @Qualifier("setErrorMessageListenerAdapter") MessageListenerAdapter adapter) { logger.debug("Created MessageContainer for NSR error event"); SimpleMessageListenerContainer res = new SimpleMessageListenerContainer(); res.setConnectionFactory(connectionFactory); res.setQueues(queue);/*from w ww . j a v a 2 s .c o m*/ res.setMessageListener(adapter); return res; }