该项目是如何将 Kafka 与 Spring Boot 结合使用的简单示例。我们将使用kafdrop显示本地 kafka 集群 UI。它有一个名为的主题product-topic,我们将通过 REST API 向其发送消息。
特点:
- Java 21
- Spring 3.2.3
- Spring for Apache Kafka
- kafdrop
开始:
$ git clone git@github.com:valdemarjuniorr/springboot3-examples.git
$ cd kafka-example
$ make start
可以使用以下命令使用本机镜像启动项目:
$ make native-start
应用程序可以运行得更快、使用更少的内存并且更安全,如此处所示。
应用程序启动后,您可以通过http://localhost:19000/访问 kafdrop UI 。
如何使用kafdrop
要创建新用户,请运行curl:
curl --location 'http://localhost:8080/products' \ |