Wednesday, March 3, 2021

#833 - OIC & OCI Notifications

 Simple example here of leveraging OIC to interact with OCI Notifications -










So what does the OCI Notification Service offer us?

The Oracle Cloud Infrastructure Notifications service broadcasts messages  to distributed components through a publish-subscribe pattern, delivering secure, highly reliable, low latency and durable messages for applications hosted on Oracle Cloud Infrastructure and externally. Use Notifications to get notified when event rules are triggered or alarms are breached, or to directly publish a message.

More details here

Create the Notification Artifacts

So off I go to OCI -


 













I create a Topic - 







I add a Subscription - 








Note the supported protocols - 










I choose Email and enter my email address - I then receive an email asking me to confirm -







I click on Confirm Subscription - thus activating the subscription in OCI - 









Ok, so that's the Notification setup complete.

There are a couple of more steps I need to execute in OCI, before creating the integration in OIC


Generate API Key in OCI

This will be required for creating the REST connection in OIC. To be honest with you, this was the only piece of complexity in the whole exercise. I did actually have to look at the documentation and follow the instructions.

Essentially I faithfully followed the instructions detailed here











I downloaded GIT - started GITBash and entered the commands to create the private and public keys -


 





The keys were stored in the following directory -






I uploaded the public key to OCI and, as they say, the rest is history.


Create the connection in OIC













The REST API for Notifications is relatively simple - 

















Here is the link to the REST API doc.

Now the integration is simple -  

REST trigger and then the Invoke to Publish a Message














SendNotification is configured as follows - 














Map as follows -








Note: I hardcode the topic ocid here.

Now to a test - 












I receive the email -























Thursday, February 25, 2021

#832 OIC Feb 21 Release - OCI Streaming Adapter as Trigger

 This post details how you can now use the OCI Streaming adapter as a Trigger in an Integration. 











So what does this mean? Essentially I can have an integration subscribing to a Stream. Publishing messages to the Stream will cause the Integration to be invoked. The adapter documentation, is, as ever, a good starting point - just click here .

OCI Streaming Adapter as Trigger

Back in November 20 - Only the Invoke role was supported. 












Now, in  February 21 - support for Trigger and Invoke roles












Let's look at this in a bit more detail - 

Here is my Streams instance - 










Now to creating the connection in OIC - 



















So let's look at the fields to be entered -

1. Bootstrap Servers - click on Kafka Connection Settings - 












2. SASL Username is a concatenation of 

tenancy/oracleidentitycloudservice/yourUser/StreamingPoolOCID

This data can be found on the same page -


 






just copy the string after username= in the SASL Connection Strings box.

3. SASL Password - go to the User tab in OCI and generate -














4. Trust Store - do the following - 

download the OCI cert from Chrome - 



Generate a trust store using keytool - 


Now import the .jks into OIC - 



Now back to the Connection definition - upload the .jks -


Test - 


Final Step - Trigger runs via the connectivity agent - In this case, I install the agent on my laptop -



Now to using it in an integration -



Consumer Group - enter whatever you want here e.g. testcg01.

Finally, a simple example f the Trigger in action -

Publish / Consume

The first integration will publish a message to my Stream.
It's called AA-Streaming-Producer -





The REST Trigger has as request an employee - 


PublishMsg is configured as follows - 




Now to the Consumer - 



Sub is configured as follows - 




The only logic is the LOG action - here I log the employee.

I activate both integrations and then test by publishing a message to the Stream.
I then check in OIC - Monitoring


I check out the activity stream -