在 Spring Cloud Stream Kinesis 中将多个流收听为一个 @StreamListener

Listen to multiple streams into one @StreamListener in Spring Cloud Stream Kinesis

我有多个 Kinesis 流需要处理。是否可以只使用一种@StreamListener 方法?

如果有,如何配置@StreamListener?

你真的可以在一个绑定上有多个目标目的地:

spring.cloud.stream.bindings.input.destination=stream1,stream2,stream3

查看有关此事的文档:https://cloud.spring.io/spring-cloud-static/spring-cloud-stream/3.0.3.RELEASE/reference/html/spring-cloud-stream.html#binding-properties

destination

The target destination of a binding on the bound middleware (for example, the RabbitMQ exchange or Kafka topic). If binding represents a consumer binding (input), it could be bound to multiple destinations, and the destination names can be specified as comma-separated String values. If not, he actual binding name is used instead. The default value of this property cannot be overridden.

从代码的角度来看,没有什么可做的。您的 @StreamListener 正在监听 input 绑定。其他一切都由框架为您完成。