Spring Cloud Stream 上的 Apache Kafka 和 Kafka Streams 有什么区别?

What is the difference between Apache Kafka and Kafka Streams on Spring Cloud Stream?

在 Spring 云网站 (https://spring.io/projects/spring-cloud-stream) 中,列出了要使用的活页夹选项。我们有 Apache Kafka 和 Kafka Streams 选项。

  1. 它们有什么区别?
  2. 为了什么目的我们应该在这两者之间做出选择?

Apache Kafka binder 用于基本的 kafka 客户端使用 consumer/producer api,

Kafka Stream binder 建立在基本的 apache kafka binder 之上,并增加了使用 kafka 流的能力 api,

Kafka streams api 是轻量级代码库,它为您提供了将数据从 topic/s in kafka 操作到其他 topic/s in kafka 的功能,允许您转换、增强、过滤,加入,聚合等等...


The Apache Kafka Binder implementation maps each destination to an Apache Kafka topic. The consumer group maps directly to the same Apache Kafka concept. Partitioning also maps directly to Apache Kafka partitions as well.

The binder currently uses the Apache Kafka kafka-clients version 2.3.1. This client can communicate with older brokers (see the Kafka documentation), but certain features may not be available. For example, with versions earlier than 0.11.x.x, native headers are not supported. Also, 0.11.x.x does not support the autoAddPartitions property

https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/3.1.3/reference/html/spring-cloud-stream-binder-kafka.html#_apache_kafka_binder

Spring Cloud Stream includes a binder implementation designed explicitly for Apache Kafka Streams binding. With this native integration, a Spring Cloud Stream "processor" application can directly use the Apache Kafka Streams APIs in the core business logic.

Kafka Streams binder implementation builds on the foundations provided by the Spring for Apache Kafka project.

Kafka Streams binder provides binding capabilities for the three major types in Kafka Streams - KStream, KTable and GlobalKTable.

Kafka Streams applications typically follow a model in which the records are read from an inbound topic, apply business logic, and then write the transformed records to an outbound topic. Alternatively, a Processor application with no outbound destination can be defined as well.

https://docs.spring.io/spring-cloud-stream-binder-kafka/docs/3.1.3/reference/html/spring-cloud-stream-binder-kafka.html#_kafka_streams_binder