Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/matlab/14.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Spring boot 在RabbitMQ中使用@StreamListener从两个不同队列中使用多条消息_Spring Boot_Rabbitmq_Microservices - Fatal编程技术网

Spring boot 在RabbitMQ中使用@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

我有两个队列,它们能够在RabbitMQ队列中生成消息。现在,我想根据该操作使用来自同一消费者服务的这些消息。一个队列是在用户添加某些项目时创建的,另一个是在用户尝试从UI中删除时创建的。 我可以使用@StreamListener消费一条消息,但是如何使用@StreamListener消费这两条消息呢

在消费者类别中:

    @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根据使用者类中的操作使用这两条消息