This project implements a post data consumption process using Spring Boot and Kafka. The process involves four components:
-
Post Data Producer:
- Fetches post data from an external API and sends it to a Kafka topic.
-
Post Topic:
- Receives post data from the Post Data Producer and forwards it to the Post Data Consumers.
-
Post Data Consumer 1:
- Consumes post data from the Post Topic and persists it to an in-memory H2 database.
-
Post Data Consumer 2:
- Consumes post data from the Post Topic and persists it to a NoSQL document database (Firebase Firestore).
To set up and run the project, you need to:
- Install Kafka.
- Create a Kafka topic called
post-data-topic
. - Build and run the Post Data Producer, Post Data Consumer 1, and Post Data Consumer 2 components.
- To send post data to the system, use the Post Data Producer component. The component accepts post data in JSON format.
- To consume post data from the system, use either Post Data Consumer 1 or Post Data Consumer 2. Post Data Consumer 1 persists post data to a relational database, while Post Data Consumer 2 persists post data to a document database.
- To use the post data consumer 2 make sure to replace the actual firebase api key in application.yaml.
- Install Kafka.
- Create a Kafka topic named
post-data-topic
. - Build and run the following components:
- Post Data Producer
- Post Data Consumer 1
- Post Data Consumer 2
# Build and run Post Data Producer
./gradlew :post_producer:bootRun
# Build and run Post Data Consumer 1
./gradlew :post_consumer1:bootRun
# Build and run Post Data Consumer 2
./gradlew :post_consumer2:bootRun