The code in this repository shows how to stream decision requests via cloud events and evaluate the corresponding decision using the Kogito Event-Driven Decisions AddOn. This is based on this repository.
Using the Traffic Violation decision model as example, producers stream cloud events containing random inputs (Driver
and Violation
information) every x
seconds. The consumer, by its turn, consumes all messages, evaluate and output the decisions made (whether or not the driver should suspended).
- Java 11 or later
- Docker Engine and Docker Compose
Clone this repository via SSH:
git clone [email protected]:caponetto/streaming-dmn-kafka.git
or via HTTPS:
git clone https://github.com/caponetto/streaming-dmn-kafka.git
Build the code:
cd streaming-dmn-kafka && \
./mvnw clean package -f streaming-dmn-kafka-producer/pom.xml && \
./mvnw clean package -f streaming-dmn-kafka-consumer/pom.xml
Start up through Docker Compose:
docker-compose up -d
Once everything is started up, the components will be available at:
- Producer A: https://localhost:8080
- Producer B: https://localhost:8081
- Consumer: https://localhost:8090
- Kafdrop: https://localhost:9000
Note: Producers start to generate messages 20 seconds after starting up so you have time to open all the URLs.
On the URLs above, you are able to check the messages that the producers are sending and the processed messages that the consumer is receiving.
Producer A: Generate messages every 5 seconds with random values for Age, Points and Actual Speed.
Producer B: Generate messages every 10 seconds with random values for Age, Points and Actual Speed.