Commit 7d781458 authored by yanzg's avatar yanzg

消费者自动创建

parent 1ac30f24
...@@ -95,22 +95,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem ...@@ -95,22 +95,6 @@ public class MqConfigurable implements RabbitTemplate.ConfirmCallback, RabbitTem
} }
} }
@Bean
public SimpleMessageListenerContainer messageListenerContainer(ConnectionFactory connectionFactory){
SimpleMessageListenerContainer container = new SimpleMessageListenerContainer();
container.setConnectionFactory(connectionFactory);
container.setQueueNames("zhihao.debug","zhihao.error","zhihao.info");
container.setMessageListener((MessageListener) message -> {
System.out.println("====接收到"+message.getMessageProperties().getConsumerQueue()+"队列的消息=====");
System.out.println(message.getMessageProperties());
System.out.println(new String(message.getBody()));
});
return container;
}
private String getId(String from) { private String getId(String from) {
return from.replace("temp:", ""); return from.replace("temp:", "");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment