BAEL-1474 Take2 (#4566)
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
##
|
||||
## Create a simple RabbitMQ environment with multiple clients
|
||||
##
|
||||
version: "3"
|
||||
|
||||
services:
|
||||
|
||||
##
|
||||
## RabitMQ server
|
||||
##
|
||||
rabbitmq:
|
||||
image: rabbitmq:3
|
||||
hostname: rabbit
|
||||
environment:
|
||||
RABBITMQ_ERLANG_COOKIE: test
|
||||
ports:
|
||||
- "5672:5672"
|
||||
volumes:
|
||||
- rabbitmq-data:/var/lib/rabbitmq
|
||||
|
||||
volumes:
|
||||
rabbitmq-data:
|
||||
|
||||
+307
File diff suppressed because it is too large
Load Diff
+29
@@ -0,0 +1,29 @@
|
||||
package org.baeldung.spring.amqp;
|
||||
|
||||
import org.springframework.amqp.core.AcknowledgeMode;
|
||||
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
|
||||
import org.springframework.amqp.rabbit.listener.MessageListenerContainer;
|
||||
import org.springframework.amqp.rabbit.listener.SimpleMessageListenerContainer;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class MessageListenerContainerFactory {
|
||||
|
||||
@Autowired
|
||||
private ConnectionFactory connectionFactory;
|
||||
|
||||
public MessageListenerContainerFactory() {
|
||||
}
|
||||
|
||||
public MessageListenerContainer createMessageListenerContainer(String queueName) {
|
||||
|
||||
SimpleMessageListenerContainer mlc = new SimpleMessageListenerContainer(connectionFactory);
|
||||
|
||||
mlc.addQueueNames(queueName);
|
||||
mlc.setAcknowledgeMode(AcknowledgeMode.AUTO);
|
||||
|
||||
return mlc;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user