In this tutorial, you learn to create an Oracle Event Hub Cloud Service - Topic instance and then produce to and consume from that Topic.
Time to Complete
Approximately 40 minutes.
Background
Oracle Event Hub Cloud Service provides a highly available and scalable messaging platform for loading and analyzing data. Users can spin up multiple clusters and create topics.
Oracle Event Hub Cloud Service - Topic helps to produce to and consume from streams of data like a messaging system. It also helps store streams of data in a distributed, and scalable cluster.
What Do You Need?
A running Oracle Event Hub Cloud Service - Platform cluster.
Oracle Event Hub Cloud Service account login credentials
Java 8 or above installed.
Maven 3 or above installed.
Eclipse Integrated Development Environment (IDE) that supports Maven installed.
Creating a Topic
Perform the following steps to create an Oracle Event Hub Cloud Service - Topic instance. You can skip this section, if you already have an Oracle Event Hub Cloud Service - Topic instance and plan to use that for this demo.
Log in to your Oracle Event Hub Cloud Service - Topic account.
In the Services page, click Create Service.
The Create Service screen appears. Provide the following details and click Next.
Service Name: topicdemo
Service Description: Example to demo topic
Hosted On: platformdemo
Number of Partitions: 2
Retention Period (Hours): 24
Description of this imageNote: The platformdemo is the name of the Oracle Event Hub Cloud Service - Platform cluster in which the topic will be created. You can provide a different name if you want to host this in a different Oracle Event Hub Cloud - Platfrom cluster.
In the Confirm page, if you find the details appropriate, click Create.
Click on the Event Hub icon adjacent to the topicdemo instance to go to the Service Overview page.
In the Service Overview page, observe the Topic field. This is the name of the Topic service that will be used in programs demonstrated in this tutorial.
The Oracle Event Hub Cloud Service - Topic instance that was created in the previous step is created in the Oracle Event Hub Cloud Service - Platform cluster which you selected while creating the Topic instance.
Note: By default the native access to Kafka is blocked due to security reasons. For the purpose of this tutorial, we will open it up to public IP. However, when setting up for development, test, or production, do restrict the native access to specific IP Addresses.
Perform the following steps to provide access rights to the users to access the Oracle Event Hub Cloud Service - Platform cluster.
Go to your Oracle Event Hub Cloud Service - Platform account.
In the Services page, click the icon in the platformdemo cluster, and then click the Access Rule item.
Note: This is the cluster that you selected while creating the topicdemo instance in the previous section. Select the same cluster that you gave in the previous section.
Description of this image
The Access Rules page is displayed. Click Create Rule.
The Create Access Rule screen is displayed. Provide the following details and click Create.
Rule Name: eventhub_public_access
Description: This rule provide public access to the cluster.
Source: PUBLIC_INTERNET
Destination: kafka_KAFKA_SERVER
Destination Ports: 6667
Protocol: TCP
Description of this imageNote: This configuration is for public access. You can provide access to specific machines by providing their address in the source field, or by using custom rules.
After you return to the Services page, click on platformdemo cluster to go the Service Overview page.
In the Service Overview page, expand Kafka option. Notice the Connect Descriptor element. This is the host name that we will use while connecting to the platformdemo service.
Go to OEHCSConsumer console and Observe. You could see that the contents that you entered in the OEHCSProducer console is displayed in the OEHCSConsumer console.
offset = 1, value = Hello World
offset = 2, value = This program demonstrates Oracle Event Hub