Spring Cloud Stream Function 中不同供应商的轮询延迟不同

问题描述

我正在尝试使用 Spring Cloud Function 和 Kafka 来实现供应商。我需要一个供应商每 10 秒发布一次,其他供应商每 30 秒发布一次。我可以从文档中看到,我可以使用 create database test create table test.A (id UInt8,data String) engine MergeTree() order by (id) create table test.B (id UInt8,data String) engine MergeTree() order by (id) insert into test.A values (0,'a'),(1,'b'),(2,'c') insert into test.B values (1,'x'),'y'),(3,'z') 属性更改延迟。 Reference

但我需要为每个主题设置不同的延迟。有什么办法吗?

解决方法

从 spring-cloud-function 的角度来看,没有任何类型的轮询,因为它不是框架的责任。 从使用 spring-cloud-function 的 spring-cloud-stream 角度来看,确实存在您描述的机制。但是,请记住,spring-cloud-stream 主要旨在支持微服务的概念(而不是您的通用消息传递框架),并且在微服务中,我们采用做一件事但做好而不影响其他的方法。因此,拥有多个供应商与这种模式背道而驰。 如果您正在构建一个通用的消息传递应用程序,那么我建议使用 Spring Integration 框架,它提供了完成您需要的所有必要的钩子,但需要更多的配置细节。