Sin*_*jad 7 spring spring-cloud-stream spring-cloud-stream-binder-kafka
我正在Spring Cloud Stream 3.1.2使用KafkaStreams. 编程模型是:
后一种使用注释,就像 Spring 提供的所有其他注释一样。但是,有提到的是
从 3.1.0 版本的 Binder 开始,我们建议对基于 Kafka Streams Binder 的应用程序使用上述函数式编程模型。从 Spring Cloud Stream 3.1.0 开始,不再支持 StreamListener。
因为我认为旧模型更具可读性(至少对我来说)。谁能解释为什么决定弃用它并支持函数式编程,并且它会被删除吗?
从Spring博客文章(https://spring.io/blog/2019/10/17/spring-cloud-stream-function-and-reactive)中可以看出a functional programming model in Spring Cloud Stream (SCSt). It\xe2\x80\x99s less code, less configuration. Most importantly, though, your code is completely decoupled and independent from the internals of SCSt。这有利于使用 Project Reactor 提供的事件流抽象(例如 Flux 和 Mono)(https://projectreactor.io/。命令式函数在每个单独的事件上触发,而反应性函数则触发一次。
| 归档时间: |
|
| 查看次数: |
12203 次 |
| 最近记录: |