Skip to content

Apache Kafka + Spring Boot (Producer and Consumers) + SSL + Zookeper

Notifications You must be signed in to change notification settings

mateuszwlosek/kafka-example

Repository files navigation

Kafka - Example

Example of Apache Kafka usage with Spring Boot.

Used Docker to containerize environment.

Kafka

  • Uses SSL authentication
  • 3 instances running

Spring Boot services

  • Use 3 instances of kafka
  • Use keystore and truststore with passwords from files
    Services

How to run the environment?

Before you start

  • Make sure you have Docker and docker-compose installed.

Docker CE INSTALLATION
Docker Compose INSTALLATION

Start the environment

  1. Build services: docker-compose build
  2. Run services: docker-compose up
  3. Request book-service:
curl --location --request POST 'localhost:6060/book/buy' --header 'Content-Type: application/json' --data-raw '{
	"accountId": 1,
	"bookId": 2,
	"deliveryDetails": {
		"street": "abc",
		"houseNumber": "123",
		"zipCode": "123456",
		"country": "ABC",
		"region": "CBA"
	}
}'

How to generate certificates

  1. Download script.
  2. Run it and type kafka in those fields: Common Name, first and last name. Also, use the same password every time when asked.
  3. Replace generated kafka.keystore and kafka.trustore with the old ones in certificates.
  4. Change password in certificates/trustore_creds, certificates/keystore_creds, certificates/sslkey_creds

About

Apache Kafka + Spring Boot (Producer and Consumers) + SSL + Zookeper

Topics

Resources

Stars

Watchers

Forks