Triggering automations from processing results

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.

  1. Check that the flow you created in the Distributing results of analysis and processing tutorial is still running.

    screenshot

    If the flow is not running, start it now.

  2. Find the EMEA orders topic in the Event Endpoint Management catalog that you added in the Share events for discovery by others tutorial.

    screenshot

    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.

  1. 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}'
    

    screenshot

  2. Create an event-driven flow and call it EMEA order notifications.

    screenshot

  3. Start the flow with a Kafka New message event.

    screenshot

    Choose Kafka from the list of Applications, and click “New message”.

  4. Click Connect.

  5. Enter connection information into App Connect (from the Event Endpoint Management catalog).

    screenshot

    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

  6. Download the certificates from the Event Endpoint Management catalog.

    screenshot

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

    screenshot

  8. Copy the contents of the edited PEM certificate file to the clipboard.

  9. Paste the edited certificate contents into the CA certificate field.

    screenshot

  10. Click Connect.

  11. Choose the ORDERS.EMEA topic.

    screenshot

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.

  1. Add a JSON parser node to the flow from the Toolbox.

    screenshot

  2. Choose the message Payload as the JSON input.

    screenshot

  3. Copy the sample message payload from the Event Endpoint Management catalog.

    screenshot

  4. Paste the sample message payload into the Example JSON box in App Connect.

    screenshot

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

  1. Add a Slack node to the flow from the “Applications & APIs” list and choose Send message.

    screenshot

  2. Click Connect and provide your Slack access token.

  3. Set the destination for messages.

    screenshot

  4. Add the message text. You can include fields from the parsed Kafka message as demonstrated in the following screen capture.

    screenshot

Step 5 : Test the flow

The flow is now ready to run. The final step is to start it.

  1. Click Start flow.

    screenshot

  2. Open Slack and verify that new orders made in the EMEA region result in a notification in the selected Slack channel.

    screenshot

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.