https://github.com/agkloop/products-compare
https://github.com/agkloop/products-compare
Last synced: 10 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/agkloop/products-compare
- Owner: agkloop
- Archived: true
- Created: 2021-01-04T23:14:29.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-07T12:21:48.000Z (over 5 years ago)
- Last Synced: 2025-04-15T09:45:09.510Z (about 1 year ago)
- Language: Java
- Size: 317 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# products-comparison
##### This project is composed of 2 microservices
* REST API (Reading ) + projection consumer that updates the db in a realtime fashion.
* Sources scraping and mapping
## REST API (Reading ) + projection consumer ##
built using reactor reactive stream on jvm and high performance batch db writing using jdbc template api
## Sources scraping and mapping ##
is built using reactive kafka that integrate reactive streams with kafka API
it's also use protobuf serialization protocol in the published messages
and communication between the producer and consumer.
## Following the reactive architecture the high level structure ##

## How it works ##
1. in the Sources/dataProvider microservice we have a scheduled task that run every day or week for each source [here](com.product.all/sources/src/main/java/com/task/sources/AppStartupRunner.java)
2. the Sources/dataProvider fetch and map the data to a common structure then push it to kafka
3. in the Projection there is a reactive consumer running to consume and update the DB in a real time with backpressure applied.
4. finally, the REST API part [here](#Try)
### what is missing ###
1. Separating the projection consumer to be a separate service using kafka-connect
2. Using elastic search cluster as a primary source of data
3. Using kubernetes
4. More test coverage
## Requirement ##
* jave 15
* maven
* Docker
## Build ##
1. run `mvn clean package` to create the jar file
2. run ` docker-compose up --build`
## Try
1. call `${localhost/docker-machine-ip}:8080/category ` to list all the available categories
2. call `${localhost/docker-machine-ip}:8080/category/{Category_id}/product/{Product_name} ` to list all the available products that have similar name with prices
eg: call `http://192.168.99.100/:8080/category/1/product/iphone `