Skip to content

Files

Latest commit

Jan 27, 2021
8b46253 · Jan 27, 2021

History

History

spring-cloud-stream-kafka

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
Apr 15, 2020
May 7, 2020
Jan 27, 2021
Apr 15, 2020
May 7, 2020

Spring Cloud Stream Apache Kafka

Description

A demo spring boot application to send and receive message from
apache kafka using spring cloud stream apache kakfa libraries

Building the application

  1. Compile the project
mvn clean package -DskipTests

This will build the jar file and also generates the docker image.
Change the username in <repository> field in pom.xml under plugins
tab so that the docker image created will have your username.\

Or you can manually build the docker image using

docker build -t <image name> .
  1. Push the docker image to dockerhub
docker push <image name>:<tag>
  1. Note down the tag of the docker image and enter the same in spring-cloud-stream-kafka.yml
    so that kubernetes can download the image

Deploying application to kubernetes

  1. Run the command
kubectl apply -f spring-cloud-stream-kafka.yaml

This will create both deployment and service

  1. Create ingress rules to access the service
kubectl apply -f ingress.yaml
  1. Now you can access the endpoints

To send a message to kafka, open the below link in your browser

http://<IP address of kubernetes cluster master>/greetings/sendmessage?message=helloworld

Or

http://<IP address of kubernetes cluster master>/greetings/send/helloworld
  1. Retrieve all the message sent using
http://<IP address of kubernetes cluster master>/greetings/readmessage