Skip to content

caponetto/streaming-dmn-kafka

Repository files navigation

Streaming decisions with DMN and Kafka

Description

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).

Requirements

Running through 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:

Note: Producers start to generate messages 20 seconds after starting up so you have time to open all the URLs.

Example

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.


Consumer: Stream of evaluated decisions.