Discovering Event Endpoint Management Admin API

When managing a number of topics in Event Endpoint Management(EEM) doing everything in the user interface can be a tedious job and prone to mistake. So it’s probably a good Idea to connect this configuration into some sort of CI/CD pipeline that automatically creates the configuration when for instance the topic is created on the Kafka broker.

To facilitate this IBM provides an admin api.

https://ibm.github.io/event-automation/eem-api/

I will be using some key concepts in this article. The description can be found on the following page.

https://ibm.github.io/event-automation/eem/about/key-concepts/

First setup the authorization by creating an api-key.

Navigate to the EEM user interface , login and open the profile menu. Here you can create an access token.

Be sure to copy the token, as it cannot be retrieved later.

Take also note of the organization in the profile page. The organization name is required in the api path.

Let’s try a simple GET operation, retrieve the already configured Kafka clusters.

 As a response we get back the already configured Kafka clusters. Proving that the connection and the api-key works.

First thing we need to do is to define an events source into EEM. This is done by the createEventSources operation. 

curl –location ‘https://eem-demo-ibm-*************/eem/eventsources‘  \

–header ‘Content-Type: application/json’ \

–header ‘Authorization: Bearer ***********’ \

–data-raw ‘{

        “clusterId”: “e6d1d39c********091dbf707831”,

        “type”: “kafka”,

        “encoding”: “application/json”,

        “name”: “CANCELLATIONS”,

        “contact”: “lynn@loosehangers.com”,

        “description”: “Events for order cancellations*********”,

        “topic”: {

            “name”: “CANCELLATIONS”        },

        “sampleMessages”: [

            “{\n    \”id\”: \”a8651c18-5360-43a3-ae08-98130a845ed4\”,\n    \”orderid\”: \”839096ce-c16e-41f2-8842-69350c6ca0e2\”,\n    \”canceltime\”: \”2023-05-20 13:08:17.828\”,\n    \”reason\”: \”BADFIT\”\n}”

        ],

        “tags”: [

            “retail”,

            “orders”

        ]

    }’

The response will be an id. This id is required to link the options. If you want to add options and you don’t have the event source id, you can first get all event sources using the GET event sources operation and search for the event source id in that response.

We need to add an option to be able to publish the event source to the gateway so that one can subscribe it in the catalog.

curl –location ‘https://eem-demo-ibm************/eem/options‘ \

–header ‘Content-Type: application/json’ \

–header ‘Authorization: Bearer ***********’ \

–data ‘{

    “eventSourceId”: “<the id from the previous response>“,

    “alias”: “CANCELLATIONS”,

    “name”: “CANCELLATIONS”,

    “description”: “Events for order ************”,

    “hidden”: false,

    “allowSubscriptions”: true,

    “gatewayGroups”: [ “gateway-group” ],

    “controls”: []

}’

 

The option is linked to the event source and is published into the catalog and consumers can now subscribe to it.

Let’ check the user interface.

The event source is created with the  provided description, sample message, …

The option is linked to the event source and event source is published to the catalog.

In the catalog a consumer can subscribe to the event source.

In this article some basic actions were described, but more advanced actions can also be done. Like updating event sources,  adding schemas etc.. Almost all manual actions can be executed by using the provided api.

Special thanks to Pierre Richelle (IBM tech-sales) to provide a demo environment and code examples.

 

Resources

https://ibm.github.io/event-automation/eem/about/overview/

https://ibm.github.io/event-automation/apiCode/eem/eem-api.html

https://github.com/prichelle/cp4i_ansible

 

Written by Kim Meynendonckx

IBM Integration Specialists

Enabling Digital Transformations.

Let's get in touch...

info@integrationdesigners.com

​ Find us here

Belgium
Veldkant 33B
2550 Kontich

Netherlands
Cruquiusweg 110F
1019 AK Amsterdam

© 2019 Integration Designers - Privacy policy - Part of Cronos Group CBX