The 24.08 release of OIC3 includes support for event filtering - so let's check this out.
Starting point is an event in my project -
I now create an integration to publish this event -Now to the Subscriber -
I test -
Now let's add a filter, I'm only interested in orders for the country of Eireann, now, from a Gaelic language perspective, this should be Poblacht na hÉireann, but let's not complicate matters.We now have the ability to add custom headers to OIC Events - these will be used to implement filtering in the subscriber integrations
So back to our event definition - the configuration wizard now contains a new screen - here I'll add a new header - countryheader.
Now I go back to the publisher integration and click through the publish action, allowing me to refresh - As you can see, the countryheader appears. I then map the country value from the incoming order to this field.I re-activate the publisher integration and then edit the subscriber -I enter the following filter query -
{"type": "jq_filter","filter-def": ".countryheader==\"Eireann\""}
I invoke the publisher again, this time with an order for Cymru (Wales) - No subscriber this time - I now invoke the publisher with an order from Eireann - I check the Observability screen - and there is our subscriber - This was a simple query, let's try something more complicated. I want to subscribe to orders from Eireann where the order status is "open".I need to add a new custom header in the Event definition - statusheader.
I need to set it's value in the "publisher" map -
The filter query will be as follows -
{"type": "jq_filter", "filter-def": ".countryheader==\"Eireann\" and .statusheader ==\"open\""}
}
Let's publish an order from Eireann with the orderStatus "pending" -
Event is not picked up by the subscriber - Now to publishing an "open" order from Eireann - Here's the syntax to filter on orders from Eireann that are open and have a value > 50k -{"type": "jq_filter", "filter-def": ".countryheader==\"Eireann\" and .statusheader ==\"open\" and .valueheader > 50000"}
Summa Summarum
No comments:
Post a Comment