Accident Management Service(AMS) is the project implemented with Event-Driven Architectural approach
that provides messages distribution across several services based on their event type, ACCIDENT_TYPE
.
It is simulation of what happens when some kind of accident happens,
it can be criminal, car, fire or some kind of accident that are saved in some
(in case of default settings: accident.events
) source topic.
Statistics Service application reads statistics events (in case of default settings it reads them from a topic:
statistics.events
) that are aggregated into StatisticalModel
by event stream application. The aggregation is
performed by kafka streams windowing operation that is based on windowed start time, windowed end time
and key (AccidentType
). The aggregated data are processed and stored in postgres SQL database.
If some error arises in process, the application sends it to dead letter topic (in case of default settings:
statistics.events-dlt
) and continues the process for other ones.
In order to start up the application you need have installed:
- Docker on you machine
- git
or - Apache kafka cluster with at least three brokers
- git
- maven 3.9.x
- JDK-17
The project installation could be done using docker-compose.yml via command line interface (CMD):
git clone https://gitlab.com/genadigeno/statistics-service.git &&
cd statistics-service &&
docker compose up
or
git clone https://gitlab.com/genadigeno/statistics-service.git &&
cd statistics-service &&
mvn clean package
java -DPOSTGRES_URL=jdbc:postgresql://localhost:5432/postgres -DPOSTGRES_USER=postgres -DPOSTGRES_PASSWORD= -jar ./target/statistics-service.jar
SERVER_PORT
- application port number, default: 8080KAFKA_MAIN_TOPIC_NAME
- kafka topic name for statistics service, default: statistics.eventsKAFKA_DLT_TOPIC_NAME
- kafka dead letter topic name for statistics service application, default: statistics.events-dltKAFKA_BOOTSTRAP_SERVERS
- kafka cluster url, default: localhost:9092,localhost:9093KAFKA_SCHEMA_REGISTRY_URL
- schema registry url, default: http://localhost:8081POSTGRES_URL
- postgres url, default: jdbc:postgresql://localhost:5432/postgresPOSTGRES_USER
- postgres user, default: postgresPOSTGRES_PASSWORD
- postgres password
Event-Driven Architecture
Java 17
Spring Boot & Spring Boot JPA
Apache Kafka & Kafka Streams library
Docker
Git
Gitlab CI/CD
Completed