Home > Articles

This chapter is from the book

Events

Oracle Cloud Events is a fully managed, cloud-based event management service offered by Oracle Cloud. It enables organizations to build and run event-driven applications by providing a platform for publishing, subscribing, and reacting to events. With Oracle Cloud Events, developers can create and publish events using various sources, including HTTP requests, database changes, and message queues. They can then subscribe to these events and create actions or functions triggered in response to the events. Oracle Cloud Events supports a wide range of event types and sources, and it can be integrated with other Oracle Cloud services, such as Oracle Functions and Oracle Autonomous Transaction Processing, to build and deploy cloud-native applications.

Before you use events, you need to add in a security policy. You also need to make a user group for the Event admins. In Example 4-4, the group is EventAdmins, and the policy is Events, with the policy being applied to the tenancy. Optionally, you can apply the policy at the compartment level.

Example 4-4 Adding a Security Policy

allow group EventAdmins to inspect compartments in tenancy
allow group EventAdmins to use tag-namespaces in tenancy
allow group EventAdmins to inspect streams in tenancy
allow group EventAdmins to use stream-push in tenancy
allow group EventAdmins to use stream-pull in tenancy
allow group EventAdmins to use virtual-network-family in tenancy
allow group EventAdmins to manage function-family in tenancy
allow group EventAdmins to use ons-topic in tenancy
allow group EventAdmins to manage cloudevents-rules in tenancy

The policy should look similar to that shown in Figure 4-16.

FIGURE 4-16

Figure 4-16 Events Policy

One of the most common event use cases is to run a function when an object is uploaded to object storage. To set this up, you need to navigate to Storage > Object Storage.

From here, you can see all of your buckets (as in Figure 4-17). You can either modify an existing bucket or create a new bucket. In this case, create a new bucket by clicking Create Bucket.

FIGURE 4-17

Figure 4-17 Bucket List

As with any bucket, you have several options. The one of interest here is Emit Object Events. Click Create as highlighted in Figure 4-18.

Next, you need to navigate to Observability & Management > Event Service > Rules. You should see the page shown in Figure 4-19.

Next, click Create Rule, which will bring up the Create Rule dialog box. In this dialog, you will be able to set up the rule. In this case, the condition is an Event Type. The service is Object Storage when an object is created. The rule will then run a function in the DevSecOps compartment from the test application called test. The completed sample is shown in Figure 4-20.

Although you are using the event to run a function, it has many more use cases. You can also generate a notification based on an event or push data to a stream. This is a capability that has many uses to both improve security and automate tasks.

Overall, Oracle Cloud Events is designed to make it easier for organizations to build and run event-driven applications by providing a scalable and reliable event management platform in the cloud.

FIGURE 4-18

Figure 4-18 Creating a Bucket

FIGURE 4-19

Figure 4-19 Event Rules

FIGURE 4-20

Figure 4-20 Object Event

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.