Message publisher API to publish messages on messaging streams. Here I am using spring cloud stream, which has variety of binder implementations avaiable. Means without doing any code changes we can easily switch the underlying messaging layer just by changing the maven dependencies.
-
Download Kafka from their official page. Download.
-
Start Zookeeper server
kafka_2.12-2.3.1\bin\windows>zookeeper-server-start.bat ....\config\zookeeper.properties
- Start Kafka broker
kafka_2.12-2.3.1\bin\windows>kafka-server-start.bat ....\config\server.properties>
- Create a Kafka Topic to publish data in it
kafka_2.12-2.3.1\bin\windows>kafka-topics.bat --create --zookeeper localhost:2181 --replication-factor 1 --partitions 1 -topic spring-cloud-stream
mvn spring-boot:run