A code challenge project which goal is to enable sending notifications using templates and user data. This project features microservices architecture and consists of 3 services:
- User service
- Template service
- Notification service
Services locate each other with Eureka discovery service and communicate using REST API. Notification service fetch data from the other two and process it asynchronously.
Template and User service store their data (templates and user list) in embedded H2 SQL database and access it using JPA 2.
Integration testing is done using Spring Cloud Contract library. Sample contracts located in user-service/test/resource/contracts and in template-service/test/resource/contracts.
- Navigate to project root
- Execute
gradlew build
- Once Gradle build is complete run
docker-compose up -d
- Wait until services start and execute
http://{host}:8081/notification/sendNewsletter
to see the list of notifications to be sent to users.
Spring WebFlux, Spring Reactor, Apache Commons Lang
Notification service need to fetch data from User service and Template service on each request to create a valid notification. To improve potential availability this service is designed to work in reactive\non-blocking manner using Spring WebFlux.
- POST http://{host}:8081/notification/sendWelcome?userId={userId} - Send a welcome notification with specified user data
- POST http://{host}:8081/notification/sendNewsletter - Send newsletters to all subscribed users
Spring Data JPA, Hibernate, Spring Web
- GET http://{host}:8082/users - Fetch all users
- GET http://{host}:8082/user/{id} - Fetch a user by id
Spring Data JPA, Hibernate, Spring Web
- GET http://{host}:8083/templates/{id} - Fetch a template by id
- GET http://{host}:8083/templates/filter?name={name} - Fetch a template by name