Skip to content

Mixing the two main ways for communication between microservices: REST and messaging

Notifications You must be signed in to change notification settings

jpOlivo/microservices-with-netflix-oss-apache-kafka

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Microservices with Netflix OSS, Apache Kafka and Spring Boot

Simple system mixing the two main ways for communication between microservices: REST and messaging.

Components

  1. Service registry (Eureka) — Where all services will register themselves
  2. Config server (Spring Cloud Config) — Where all services will take their configurations from. Config server will keep configuration files in git repository
  3. Gateway (Zuul) — that will redirect all the requests to the needed microservice
  4. User service — using this one the new users will register. On every new registration the User service will send a message “USER_REGISTERED” to the message broker (Kafka)
  5. Email service — using this one we will send emails. On “USER_REGISTERED”message received the Email service will send a confirmation email to the new user

Requirements

The asynchronous communication is performed through Apache Kafka, therefore first it must be started

Kafka uses ZooKeeper so you need to first start a ZooKeeper server if you don't already have one.

> bin/zookeeper-server-start.sh config/zookeeper.properties

Now start the Kafka server:

> bin/kafka-server-start.sh config/server.properties

Example of usage

  1. Start the Service registry (ms-discovery)
  2. Start the Config server (ms-config-server)
  3. Start the Gateway (ms-gateway)
  4. Start the User service (ms-user)
  5. Start the Mail service (ms-mail)
  6. Register a new user
curl -X POST \
  http://localhost:8765/api/user \
  -H 'Content-Type: application/json' \
  -H 'cache-control: no-cache' \
  -d '{
	"username": "[email protected]",
	"password": "mynewpass"
}'
  1. Validate that the new user has been registered on User service
  2. Validate that a new mail has been received on [email protected] account

About

Mixing the two main ways for communication between microservices: REST and messaging

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages