Skip to content

Sketch for Microservices Architecture with Spring Cloud and HAL

Notifications You must be signed in to change notification settings

YegresOm/parking-reservation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sketch for Microservices Architecture with Spring Cloud and HAL

This project contains five services:

  • Registry is Eureka service registry (https://github.com/Netflix/eureka)
  • UI-proxy is Zuul routing service https://github.com/Netflix/zuul
    • This is facade for UI communication
  • Parking and User are REST entity services implemented with Spring Data Rest (https://projects.spring.io/spring-data-rest)
    • For sketch purpose db is in-memory and populated with one test entity
  • Reservation is a task service with exported REST storage for reservations
    • Provides endpoint for new reservation: PUT /reservation/user/{name}/parking/{number}
      Correct response is status 201 Created with Location Header
    • With Spring profile "amqp" enabled connects with RabbitMQ on localhost:5672 and creates Fanout exchange "parking.reservations" (https://spring.io/guides/gs/messaging-rabbitmq)
      After successful reservation sends message with created reservation

How to start

All projects contains Maven Wrapper (https://github.com/takari/maven-wrapper) and could be started with

$ ./mvnw spring-boot:run
  • UI-proxy starts on localhost:8000
  • Registry on localhost:8761
  • Parking, User and Reservation services on localhost:0 (random ports)

To enable AMQP on Resevation service run it with

$ ./mvnw spring-boot:run -Dspring.profiles.active=amqp

After all services are started and discovery cache is updated you can create reservation

$ curl -X PUT localhost:8000/reservation/user/user/parking/12345

Next possible steps

  • Forbid POST/PUT/PATCH for Reservation
  • Add authorization service and secure POST/PUT/PATCH for User and Parking
  • Add configuration service

About

Sketch for Microservices Architecture with Spring Cloud and HAL

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published