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 -

No comments: