Tuesday, January 10, 2023

#947 OIC integration with OCI Queues

 


The OCI Queues service is now available under Developer Services - Application Integration section in your OCI console - 


Queues provides application decoupling, reliable message processing. OCI Queues auto-scales and can be invoked via REST.

Let's create a queue - ordersQueue.


 

 












So we see the queues is up and running.

Now to testing with the OC Queues API - for this we will need some information from the Queue itself -





we need the OCID, NOT the DLQ OCID!!!

We also require the Messages endpoint.

Apart from that, you will need your OCI tenancy OCID, your OCI user OCID. You need to create an API Key for your user and save the private and public keys, as well as the fingerprint.





















I downloaded the Queues section from the OCI REST collection available at postman.com. You can see that collection here.






































I then created an environment for OCI in my desktop Postman - 




I now try out the POST to create a message -


Please note, I have used a path variable to set the queue ocid - 


I check out the messages in the OCI console - 



Now to OIC...

Create an OCI Queues Connection 

Here I use the OIC REST adapter with security - OCI Signature Version 1 -






Now to the integration - it is very simple - essentially Rest trigger and the invoke of OCI Queues.

The REST Request payload is as follows - 

























Just to recap - the REST payload for the POST Message api call is in the following format - i.e. Message is a string.













I want to push the {order} structure to the queue - so I need to surface the json in a string. I do this in the Assign action below - 




Here is the Assign - takeaway here is to use \ to escape double quotes, comma etc.

























After initially publishing this post, my esteemed colleague - Valeria C. told me this could be simplified  - concat ('{', '"message"', ":", '"', /nssrcmpr:execute/ns15:request-wrapper/ns15:message, '"', '}' )
Simply wrap double quotes, commas etc. in single quotes. Net, net - there are 2 ways of doing this - the hard way or... 
 
Now on to the configuration of the Invoke of OCI Queues -








I map the v_orderAsString variable to the content field.

Let's test this out!



I check in the OCI Queues console - 




OCI Queues is another compelling tool in your OCI toolkit. Full documentation is available here. This also includes the relevant service limits section -


 








No comments: