Spring boot 在RabbitMQ中使用@StreamListener从两个不同队列中使用多条消息
我有两个队列,它们能够在RabbitMQ队列中生成消息。现在,我想根据该操作使用来自同一消费者服务的这些消息。一个队列是在用户添加某些项目时创建的,另一个是在用户尝试从UI中删除时创建的。 我可以使用@StreamListener消费一条消息,但是如何使用@StreamListener消费这两条消息呢 在消费者类别中:Spring boot 在RabbitMQ中使用@StreamListener从两个不同队列中使用多条消息,spring-boot,rabbitmq,microservices,Spring Boot,Rabbitmq,Microservices,我有两个队列,它们能够在RabbitMQ队列中生成消息。现在,我想根据该操作使用来自同一消费者服务的这些消息。一个队列是在用户添加某些项目时创建的,另一个是在用户尝试从UI中删除时创建的。 我可以使用@StreamListener消费一条消息,但是如何使用@StreamListener消费这两条消息呢 在消费者类别中: @StreamListener(target = Sink.INPUT) public void processRegisterAdd(String me
@StreamListener(target = Sink.INPUT)
public void processRegisterAdd(String message) throws JsonParseException, JsonMappingException, IOException {
System.out.println("for adding item message in queue: " + message);
}
/* @StreamListener(target = Sink.INPUT)
public void processRegisterDelete(String message) throws JsonParseException, JsonMappingException, IOException {
System.out.println("for deleting item message in queue: " + message);
}*/
在Consumer application.properties中:
spring.cloud.stream.bindings.input.destination=itemRetrival
spring.cloud.stream.bindings.input.group=itemRetrivalQueue
如何使用@StreamListener根据使用者类中的操作使用这两条消息