{"id":5452,"date":"2024-12-02T20:38:06","date_gmt":"2024-12-02T20:38:06","guid":{"rendered":"https:\/\/dalelane.co.uk\/blog\/?p=5452"},"modified":"2024-12-02T21:07:09","modified_gmt":"2024-12-02T21:07:09","slug":"api-enrichment-in-event-processing","status":"publish","type":"post","link":"https:\/\/dalelane.co.uk\/blog\/?p=5452","title":{"rendered":"API Enrichment in Event Processing"},"content":{"rendered":"<p><strong>Creating an Apache Flink job using IBM Event Processing that identifies customer retention opportunities<\/strong><\/p>\n<p>This is a demo of <a href=\"https:\/\/www.ibm.com\/products\/event-automation\/event-processing\">IBM Event Processing<\/a> that I gave today. The focus was meant to be how <a href=\"https:\/\/ibm.github.io\/event-automation\/ep\/nodes\/enrichmentnode\/#enrichment-from-an-api\">API Enrichment<\/a> (enriching a stream of events with reference data from external sources) can inform the processing of your Flink job, but it ended up being a useful example of filtering and transforming, too.<\/p>\n<p><iframe loading=\"lazy\" width=\"450\" height=\"280\" style=\"border: thin black solid;\" src=\"https:\/\/www.youtube.com\/embed\/mzlQZBVg6HA?si=yNYtdpayLxwLTK4d\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen><\/iframe><br \/>\n<small><a href=\"https:\/\/youtu.be\/mzlQZBVg6HA\">narrated demo at youtu.be\/mzlQZBVg6HA<\/a><\/small><\/p>\n<p><!--more--><\/p>\n<h3>Scenario<\/h3>\n<p><a href=\"https:\/\/ibm.github.io\/event-automation\/tutorials\/guided\/tutorial-0\">Loosehanger Jeans is a (fictional) clothing retailer<\/a>. They have a stream of events for cancelled orders: any time a customer cancels an order, there is an event with information about the order and the customer&#8217;s reason for cancelling it.<\/p>\n<p>The objective for the event processing flow was to explore how &#8220;Loosehanger&#8221; could be more responsive to these customers, and identify opportunities to effectively reach out to customers with a more compelling offer.<\/p>\n<p>For this first flow, I focused on orders that were cancelled due to price, where Loosehanger could offer them a custom discount as an incentive to make a new order.<\/p>\n<p>As they wouldn&#8217;t want to offer a discount to &#42;everyone&#42; who cancels an order, the role of API Enrichment in this demo was to use data from Loosehanger&#8217;s customer loyalty programme to inform the processing that identifies which cancellation events to respond to.<\/p>\n<h3>Creating this demo for yourself<\/h3>\n<p>Instructions for creating this demo are available at <br \/><a href=\"https:\/\/github.com\/dalelane\/kafka-demos\/blob\/master\/README.md#rest-api-for-enriching-loosehanger-jeans-events\">github.com\/dalelane\/kafka-demos<\/a>. <\/p>\n<p>All of this can be deployed into an OpenShift cluster. The setup includes:<\/p>\n<ul>\n<li>an Ansible playbook that:\n<ul>\n<li>creates the Kafka and Flink clusters<\/li>\n<li>deploys the Event Automation UI&#8217;s<\/li>\n<li>starts the data generator that creates random order and order-cancellation events<\/li>\n<\/ul>\n<\/li>\n<li>an OpenLiberty implementation of the &#8220;customer loyalty&#8221; REST API, with the OpenAPI document for the API to allow invoking from Flink<\/li>\n<\/ul>\n<p>If you&#8217;d like to try this for yourself, please let me know if I can help. Playing around with a live stream of events (<em>as you can see me do in the video<\/em>) is a great way to understand what is possible.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Creating an Apache Flink job using IBM Event Processing that identifies customer retention opportunities This is a demo of IBM Event Processing that I gave today. The focus was meant to be how API Enrichment (enriching a stream of events with reference data from external sources) can inform the processing of your Flink job, but [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[610],"class_list":["post-5452","post","type-post","status-publish","format-standard","hentry","category-ibm","tag-flink"],"_links":{"self":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5452","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=5452"}],"version-history":[{"count":0,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=\/wp\/v2\/posts\/5452\/revisions"}],"wp:attachment":[{"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=5452"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=5452"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/dalelane.co.uk\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=5452"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}