Spring Cloud Stream-手动使用按需数据吗?

问题描述 投票:0回答:1

使用Spring Data Stream,如何从队列开始读取并按需停止读取?

我想要这样的事情:

@EnableBinding(Sink.class)
public class SomeConsumer {

  @StreamListener(target = Sink.INPUT)
  public void receiveMsg(Message<String> message)
  {
    logger.info(" received new message [" + message.toString() + "] ");
  }

  public static void startReceiving()
  {
     //How to implement this logic?
  }

  public static void stopReceiving()
  {
     //How to implement this logic?
  }

}
spring-boot spring-integration spring-cloud-stream spring-amqp spring-rabbitmq
1个回答
0
投票

无法通过静态方法完成;自动连接BindingsEndpoint并使用changeState()方法。

请参阅我对this question的回答。

© www.soinside.com 2019 - 2024. All rights reserved.