我将Spring Cloud Stream 3.1.2
用于KafkaStreams
。程序设计模型如下:
Programming
后者使用注释作为Spring提供要使用的所有其他注释。但是,有人提到
从3.1.0版本的绑定器开始,我们建议对基于Kafka流绑定器的应用程序使用上面描述的函数编程模型。从Stream的3.1.0开始,不再支持StreamListener。
因为我认为旧的模型更易读(至少对我来说是这样)。有谁能解释一下为什么决定放弃它来支持函数式编程,它会被删除吗?
发布于 2021-04-03 01:33:19
从Spring文章(https://spring.io/blog/2019/10/17/spring-cloud-stream-functional-and-reactive)中可以看到a functional programming model in Spring Cloud Stream (SCSt). It’s less code, less configuration. Most importantly, though, your code is completely decoupled and independent from the internals of SCSt
。这有利于使用项目反应堆(https://projectreactor.io/)提供的事件流抽象(如Flux和Mono)。命令式函数在每个单独的事件上被触发,而反应性函数被触发一次。
https://stackoverflow.com/questions/66924979
复制相似问题