Solution walkthrough
1. Under the hood: Step through Review moderation flow
-
Navigate to streams for Apache Kafka console. Filter for the term reviews to view 3 related topics.
-
Click on the
globex.reviews
topic to see an Overview of the topic page -
Click on any of the message to view the complete message payload
-
Click on the headers tab and take note of the headers of the message. This is what each of them mean:
-
ce_id: 1 - This is a unique id for each message.
-
ce_source: submit-review and ce_type: submit-review-event - These are the primary values which are used by the Knative triggers to route the message to the right Knative service.
-
-
Navigate back to the {openshift_cluster_console}/topology/ns/globex-serverless-{user_name}?view=graph[Topology View, window="console"], to view the corresponding mapping in the Knative Broker and Triggers
-
Click on the blue link (highlighted in blue below) pointing to
aiml-moderate-reviews
service. This link represents themoderate-reviews-trigger
. -
The right-hand panel shows the trigger’s source = submit-review and type = submit-review-event.
-
You will note that this matches the CloudEvents headers in the Kafka message that you viewed in streams for Apache Kafka Console browser.
-
This is how the Knative Triggers match the messages to the right endpoint.
-
-
Once the reviews are sent to the
aiml-moderate-reviews
(Python) service, it uses the Hate-speech-CNERG/english-abusive-MuRIL AI/ML model to identify if the product review is abusive or not.-
A score of
-1
is assigned if the review is acceptable or0
if the comment is abusive. -
This service then POSTs the review with the score to the
moderated-reviews-sink
(with the help of the ServiceBinding which binds the sink to the services). -
This sink is configured to write to the
reviews.moderated
topic. Here is a sample message of how a moderated review (kafka message) looks like in the streams for Apache Kafka console.
-
-
Next, the message is sent to the
persist-reviews
Quarkus service through thepersist-reviews-trigger
trigger. This service persists the review in a Postgresql DB if the score less than0
(that is, the review is acceptable)-
Note that the trigger’s filter’s source and type matches the ce_type and ce_source headers of the message from the
reviews.moderated
topic shown in the screenshot above.
-
2. Under the hood: Review sentiment analysis
The Review sentiment analysis flow is quite similar to the Moderate Review flow.

-
The
sentiment-reviews-trigger
responds to the same CloudEvents filter headers as themoderate-reviews-trigger
; this is because when a review is submitted, they need to be processed by both the moderate and analyse services. -
The
aiml-sentiment-reviews
which is invoked, then uses the nlptown/bert-base-multilingual-uncased-sentiment to identify a score (from -1 to 4) depending on the tone of the review. -
The review is then sent to the
reviews.sentiment
topic. Access this topic in the streams for Apache Kafka console. Click on any of the kafka messages to view the sentiment score.
As a next step, this sentiment score can be used to build a dashboard to visualise the sentiment of various categories of products. This is out of the scope of this workshop, but here is a sample dashboard built using Grafana.

3. Congratulations
Congratulations! With this you have completed the Event Driven Applications workshop module!
Please close all but the Workshop Deployer browser tab to avoid proliferation of browser tabs which can make working on other modules difficult. |
Proceed to the Workshop Deployer to choose your next module.