A modern ecommerce platform that has many sets of microservices: customer, order, product, inventory, payment, shipping/delivery etc. For this exercise, you are going to focus on the order microservice using Spring Boot. Please read the Ecom-Order-Processing-Service.pdf for details.
- Use Java8 (or higher version of Java), or Kotlin for the programming language.
- Spring Boot, Spring Data JPA, and other Spring modules for the microservices.
- Design new schema keeping PostgreSQL in the mind.
- For the RESTful API, use Swagger to document your endpoints. Use appropriate HTTP verbs and status codes. Assume no AuthN or AuthZ is required for the API.
- Implement unit and/or integration tests.
- Containerize your services using Docker. Use docker-compose if required.
- If you are thinking about async communication patterns, use Apache Kafka.
- See, if you can follow few of the 12 Factor App Principles (https://12factor.net).
The project is deployed using Docker-compose and has the following Services:
- Order-Service:
- Microservice based on Spring Boot.
- Database:
- PostgreSQL database
- Kafa:
- Stream-processing software platform
- Zookeeper:
- Centralized service for maintaining configuration information and Kafka Cluster
- KafkaDrop:
- A web UI for viewing Kafka topics and browsing consumer groups.
Docker Desktop
git
IDE
- Order service is being called by a valid user having a valid user ID.
- The User session is maintained and validated using Using OIDC by an agregator service or an API Gateway.
- We are assuming there are separate services for catalogue (which will handle crud operations relevant to objects such as items dealers, warehouse), Payment service (which will maintain trasanction related intricate details and card information), Shipping Services.
- In-place of these services we are calling json stubs for fetching neceessary data.
To run all services use the following command.
docker-compose up -d
You can run services individually by running the following command with the service name
docker-compose up -d <service-name>
- Pre-req: To run order-service using IDE, you need to first configure PostgreSQL and Kafka locally or run these services individually using dockeer-compose command mentioned above.
- Insall IDE (preferrably Eclipse)
- Clone the repository using http or ssh
- Open the spring project in the IDE
- Run project as "Spring Boot App"
- Use any API testing tool (Example: Postman) or hit url http://localhost:8080/swagger-ui/ then click on an api spec and 'Try it out' button.
- Run the project as JUnit test cases by right click and run as "JUnit test cases"
- By command line use
mvn test