[英]Spring-Kafka vs. Spring-Cloud-Stream (Kafka)
Using Kafka as a messaging system in a microservice architecture what are the benefits of using spring-kafka vs. spring-cloud-stream + spring-cloud-starter-stream-kafka ? 使用Kafka作为微服务架构中的消息传递系统,使用spring-kafka与spring-cloud-stream + spring-cloud-starter-stream-kafka有什么好处?
The spring cloud stream framework supports more messaging systems and has therefore a more modular design. Spring云流框架支持更多的消息传递系统,因此具有更多的模块化设计。 But what about the functionality ?
但功能呢? Is there a gap between the functionality of spring-kafka and spring-cloud-stream + spring-cloud-starter-stream-kafka ?
spring-kafka和spring-cloud-stream + spring-cloud-starter-stream-kafka的功能之间是否存在差距? Which API is better designed?
哪个API设计得更好?
Looking forward to read about your opinions 期待阅读您的意见
Spring Cloud Stream with kafka binder rely on Spring-kafka. 带有kafka活页夹的Spring Cloud Stream依赖于Spring-kafka。 So the former has all functionalities supported by later, but the former will be more heavyweight.
所以前者所有功能都得到了后来的支持,但前者会更加重量级。 Below are some points help you make the choice:
以下是一些有助于您做出选择的要点:
Use Spring Cloud Stream when you are creating a system where one channel is used for input does some processing and sends it to one output channel. 在创建系统时使用Spring Cloud Stream ,其中一个通道用于输入进行一些处理并将其发送到一个输出通道。 In other words it is more of an RPC system to replace say RESTful API calls.
换句话说,它更像是一个RPC系统来取代说RESTful API调用。
If you plan to do an event sourcing system, use Spring-Kafka where you can publish and subscribe to the same stream. 如果您打算使用事件采购系统,请使用Spring-Kafka,您可以在其中发布和订阅相同的流。 This is something that Spring Cloud Stream does not allow you do do easily as it disallows the following
这是Spring Cloud Stream不允许您轻松完成的事情,因为它不允许以下内容
public interface EventStream {
String STREAM = "event_stream";
@Output(EventStream.STREAM)
MessageChannel publisher();
@Input(EventStream.STREAM)
SubscribableChannel stream();
}
A few things that Spring Cloud Stream helps you avoid doing are: Spring Cloud Stream帮助您避免做的一些事情是:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.