Skip to content

genadigeno/statistics-service

Repository files navigation

Accident Management Service(AMS)

Project Description

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.

Visual

alt text

Statistics Service application description

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.

alt text

Getting started

Installation requirements

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

Installation steps

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

JVM Parameters

  • SERVER_PORT - application port number, default: 8080
  • KAFKA_MAIN_TOPIC_NAME - kafka topic name for statistics service, default: statistics.events
  • KAFKA_DLT_TOPIC_NAME - kafka dead letter topic name for statistics service application, default: statistics.events-dlt
  • KAFKA_BOOTSTRAP_SERVERS - kafka cluster url, default: localhost:9092,localhost:9093
  • KAFKA_SCHEMA_REGISTRY_URL - schema registry url, default: http://localhost:8081
  • POSTGRES_URL - postgres url, default: jdbc:postgresql://localhost:5432/postgres
  • POSTGRES_USER - postgres user, default: postgres
  • POSTGRES_PASSWORD - postgres password

Used Technologies

  • img Event-Driven Architecture
  • img Java 17
  • img Spring Boot & Spring Boot JPA
  • img Apache Kafka & Kafka Streams library
  • img Docker
  • img Git
  • img Gitlab CI/CD

Project status

Completed

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published