Using MySql, Kafka and Mongo services demonstrate a Spring Boot application which provides some REST services. Please follow the guide to obtain more details about the project.
Follow the instructions to set up the project in your local environment.
- JDK 11
- Docker
Please run the command in the project's root folder where placed docker-compose.yml
.
Use docker-compose up --build
command to launch all services. You may encounter a memory leak or some system issue
due to consume too much system resource. If this happens you can make passive some lines in the docker-compose.yml
.
To add a new property to the system you need the following services. Make passive the lines related rest of the services in the file.
property-seeder
property-store
kafka
zookeeper
property-db
To acquire a property on the system you need the following services.
location
location-db
category
category-db
property-search
property-viewer
property-db
Location service is a Spring Boot application which communicates to a MySql database. It provides all the Turkish cities.
curl --location --request GET 'http://<HOST>:<PORT>/api/cities'
[
{
"id": 1,
"name": "Adana"
},
{
"id": 7,
"name": "Antalya"
},
{
"id": 3,
"name": "Afyon"
}
]
Category service is a Spring Boot application which communicates to a Mongo database. It provides all the categories.
curl --location --request GET 'http://<HOST>:<PORT>/api/categories'
[
{
"id": 1,
"name": "arsa"
},
{
"id": 2,
"name": "ticari"
},
{
"id": 2,
"name": "konut"
}
]
Property Viewer service is a Spring Boot application which communicates to a Mongo database. It provides a single property with a unique ID.
curl --location --request GET 'http://<HOST>:<PORT>/detay/1'
{
"categoryId": 1,
"cityId": 1,
"title": "title",
"currency": "TL",
"price": 1.0
}
Property Seeder service is a Spring Boot application which communicates to a Kafka. It provides commands on Kafka cluster which are consumed by another service after to store in a Mongo database.
curl --location --request POST 'http://<HOST>:<PORT>/api/property' \
--header 'Content-Type: application/json' \
--data-raw '{
"categoryId": 1,
"cityId": 1,
"title": "title",
"currency": "TL",
"price": 1.0
}'
Property Store service is a Spring Boot application which communicates to a Kafka and a Mongo database.
It consumes commands (AddNewPropertyCommand
) from Kafka cluster and evaluates them to the Mongo database
and finally publishes the events (NewPropertyAdded
).
Property Search service is a Spring Boot application which communicates to a Mongo database. It provides properties to end users with proper parameters. Also, it provides friendly urls if it is possible.
curl --location --request GET 'http://<HOST>:<PORT>/arama?category=1'
{
"page": 1,
"pageSize": 5,
"totalPage": 1,
"rootUrl": "http://localhost:8085/arama/konut",
"result": [
{
"id": "62cb01abeea8f02618dcfa7c",
"category": "Konut",
"city": "Adana",
"title": "title",
"currency": "TL",
"price": 1.0
}
]
}
curl --location --request GET 'http://<HOST>:<PORT>/arama?category=1&page=2'
{
"page": 2,
"pageSize": 5,
"totalPage": 2,
"rootUrl": "http://localhost:8085/arama/konut",
"result": [
{
"id": "62cb01b1eea8f02618dcfa81",
"category": "Konut",
"city": "Adana",
"title": "title",
"currency": "TL",
"price": 1.0
}
]
}
curl --location --request GET 'http://<HOST>:<PORT>/arama?category=1&city=1'
{
"page": 1,
"pageSize": 5,
"totalPage": 1,
"rootUrl": "http://localhost:8085/arama/konut/adana",
"result": [
{
"id": "62cb01b0eea8f02618dcfa7f",
"category": "Konut",
"city": "Adana",
"title": "title",
"currency": "TL",
"price": 1.0
}
]
}
curl --location --request GET 'http://<HOST>:<PORT>/arama?category=1&city=1&city=2'
{
"page": 1,
"pageSize": 5,
"totalPage": 1,
"rootUrl": "http://localhost:8085/arama?category=1&city=1&city=7",
"result": [
{
"id": "62cb01abeea8f02618dcfa7c",
"category": "Konut",
"city": "Adana",
"title": "title",
"currency": "TL",
"price": 1.0
},
{
"id": "62cb01b1eea8f02618dcfa81",
"category": "Konut",
"city": "Antalya",
"title": "title",
"currency": "TL",
"price": 1.0
}
]
}