Skip to content

choiis/kafka-spring

Repository files navigation

kafka-Spring

reactor-kafka spring boot producer + spring kafka consumer

Execution

  • Execute kafka, zookeeper, kafka-ui, consul with docker
docker-compose -f docker/docker-compose.yml up -d
  • Execute spring boot producer and consumer
./gradlew -p reactor-producer bootRun
./gradlew -p consumer bootRun
  • You can turn the switch on and off with an API call.
curl -i -X GET \
  'http://localhost:18080/on'

curl -i -X GET \
  'http://localhost:18080/off'

  • When I call it from restapi, the consumer works and keeps a log.
curl -i -X POST \
   -H "Content-Type:application/json" \
   -d \
'{
  "name":"insung",
  "number":10
}' \
 'http://localhost:10100/api/producer'

Run all with docker-compose

  • build all
./gradlew clean build docker
  • run all with docker-compose
docker-compose up -d