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.
Event stream application reads and distributes the incoming accident events to specific sink topics in real-time,
such are emergency.events
, police.events
, fire-rescue.evens
and so on... If some error arises event stream
application sends it to dead letter topic(in case of default settings: accident.events-dlt
) with valuable additional
information and continues process for other ones. That provides possibility of monitoring of the corrupted events for an
event source application. Distribution mechanism depends on an accident type, for example if the accident type is
criminal it will be sent to emergency and police services, however if it is fire accident then - police, emergency and
fire-rescue service.
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/accident-event-stream.git ams-event-stream &&
cd ams-event-stream &&
docker compose up
or
git clone https://gitlab.com/genadigeno/accident-event-stream.git ams-event-stream &&
cd ams-event-stream &&
mvn clean package &&
java -jar ./target/accident-event-stream.jar
SERVER_PORT
- application port number, default: 8080FIRE_RESCUE_SERVICE_TOPIC_NAME
- kafka topic name for fire-rescue service, default: fire-rescue.eventsSTATISTICS_SERVICE_TOPIC_NAME
- kafka topic name for statistics service, default: statistics.eventsPOLICE_SERVICE_TOPIC_NAME
- kafka topic name for police service, default: police.eventsEMERGENCY_SERVICE_TOPIC_NAME
- kafka topic name for emergency service, default: emergency.eventsSOURCE_TOPIC_NAME
- kafka source topic name for event stream application, default: accident.eventsDLT_SOURCE_TOPIC_NAME
- kafka dead letter topic name for event stream application, default: accident.events-dltBOOTSTRAP_SERVERS
- kafka cluster url, default: localhost:9092,localhost:9093SCHEMA_REGISTRY_URL
- schema registry url, default: http://localhost:8081AVRO_SUBJECT_VERSION
- subject version of avro serde, default: latestCACHE_MAX_SIZE_BUFFERING
- buffer size of statefull operations, default: 0STATE_DIRECTORY
- state store directory, default: ./state-dir
Example java -DSERVER_PORT=9898 -DBOOTSTRAP_SERVERS=localhost:9092 -jar ./target/accident-event-stream.jar
Event-Driven Architecture
Java 17
Spring Boot & Spring Boot JPA
Apache Kafka & Kafka Streams library
Docker
Git
Gitlab CI/CD
Completed