Scenario
In this scenario, we will generate notifications in response to events recognized in an Event Processing flow.
This is an extension to the Share events for discovery by others tutorial. In that tutorial, we identified specific orders, produced them to a new destination topic, and published that topic in the Event Endpoint Management catalog.
To show how this can be used, this tutorial shows you how to use that topic in App Connect.
Before you begin
You need to deploy an App Connect Designer. Instructions for how to do this are included in the Setup tutorial.
The example App Connect flow in this tutorial sends notifications to Slack. You will need an access token for the Slack API to complete the tutorial as described below, alternatively you can choose a different destination for your notifications.
Versions
This tutorial uses the following versions of Event Automation capabilities. Screenshots may differ from the current interface if you are using a newer version.
- Event Streams 11.3.1
- Event Endpoint Management 11.1.5
- Event Processing 1.1.5
- App Connect 11.2.1
Instructions
Step 1 : Find the destination topic
This tutorial begins with the topic added to the catalog in Share events for discovery by others tutorial, which identifies orders made in the EMEA region.
If you haven’t completed that tutorial yet, you should do it now.
-
Check that the flow you created in the Distributing results of analysis and processing tutorial is still running.
If the flow is not running, start it now.
-
Find the EMEA orders topic in the Event Endpoint Management catalog that you added in the Share events for discovery by others tutorial.
If you need a reminder about how to access the Event Endpoint Management catalog you can review Accessing the tutorial environment.
Step 2 : Make the destination topic available to App Connect
The first thing to do is to make this destination topic available for use in App Connect.
-
Go to the App Connect Designer
You can get the URL for the designer from the
designer-ui
route.If you have
oc
CLI access to your OpenShift cluster, you can use this:oc get route \ designer-ui \ -n event-automation \ -o jsonpath='https://{.spec.host}'
-
Create an event-driven flow and call it
EMEA order notifications
. -
Start the flow with a Kafka New message event.
Choose Kafka from the list of Applications, and click “New message”.
-
Click Connect.
-
Enter connection information into App Connect (from the Event Endpoint Management catalog). Select the Self service (redacted) option, as you do not need customer details for this processing.
Authorization type:
SASL_SSL
Username: Username created using the Generate access credentials button in the Event Endpoint Management catalog
Password: Password created using the Generate access credentials button in the Event Endpoint Management catalog
Kafka brokers list: Server address copied from the Event Endpoint Management catalog
Security mechanism:
PLAIN
-
Download the certificates from the Event Endpoint Management catalog.
-
Prepare the downloaded certificate file for use with App Connect.
Open the downloaded pem file in a text editor.
Delete the first certificate from the file. Keep only the final certificate (the last
-----BEGIN CERTIFICATE-----
and-----END CERTIFICATE-----
and everything between). -
Copy the contents of the edited PEM certificate file to the clipboard.
-
Paste the edited certificate contents into the CA certificate field.
-
Click Connect.
-
Choose the
ORDERS.EMEA.REDACTED
topic.
Step 3 : Parse the Event Processing output
The next step is to parse the events on the topic to allow it to be used in App Connect flows.
-
Add a JSON parser node to the flow from the Toolbox.
-
Choose the message Payload as the JSON input.
-
Copy the sample message payload from the Event Endpoint Management catalog.
-
Paste the sample message payload into the Example JSON box in App Connect.
-
Click the Generate Schema button.
Step 4 : Send notifications in response to the events
The next step is to complete the App Connect flow by adding a node to send notifications.
-
Add a Slack node to the flow from the “Applications & APIs” list and choose Send message.
-
Click Connect and provide your Slack access token.
-
Set the destination for messages.
-
Add the message text. You can include fields from the parsed Kafka message as demonstrated in the following screen capture.
Step 5 : Test the flow
The flow is now ready to run. The final step is to start it.
-
Click Start flow.
-
Open Slack and verify that new orders made in the EMEA region result in a notification in the selected Slack channel.
Recap
The App Connect Designer is a good example of an application to use when you want to trigger automations and notifications from event processing results.
Making the results of an Event Processing flow available on a Kafka topic, and sharing it to allow it to be used through Event Endpoint Management, allows for the situations identified in the events to trigger a wide range of automations and workflows.