Friday, September 24, 2021

#879 - OIC Pub/Sub with OCI Streaming

Simple use case here - publish and subscribes to events from Shopify. 





Normally I would be doing this with orders, however, my trial Shopify account doesn't allow me to create orders, so I'm leveraging Products here. But, I know you are all experts at extrapolating.

Now someone may think of using Pub/Sub pattern available when creating a new integration in OIC. However, as you can see - it has been deprecated.




 




The publish to OIC integration style has been deprecated. Oracle recommends that you use app driven orchestration and use an invoke to publish a message into the OIC streaming service.

So let's take that advice -

Here is my Stream - ProductStream-NiallC









Now to the Connection creation in OIC - Please see my Shopify blog posts for details on how to create that connection. So now to the OCI Streaming connection creation - 



 Bootstrap Servers entry can be found here - 
As you can see, it also contains the SASL username. You need to generate an Auth Token for the SASL Password - 














Check out the OIC OCI Streaming adapter docs for the steps to create the Trust Store. Test and Save the Connection - 





Now to the "Publish" integration - very simple really - 














I get the JSON for the PublishProduct request payload from the Shopify api docs here














Configuration of the PublishProduct action is as follows - 












I activate and test by creating a new product in Shopify and then check out the stream - 



So that's the Publish part addressed. Now to the subscribe - for this I use a Scheduled Integration - 












The above is the final result - let's look at the integration in detail - 






















Subscribe2NewProduct is configured as follows - 














Now to the message structure - 


 








This I copy from the Recent Messages view from Streaming












The only logic I add is a LOG action - to output the product name - 







Now to testing the Subscribe - 

I add 2 new products in Shopify -









I run the scheduled integration -



No comments:

Post a Comment