Before You Begin
This 15-minute tutorial shows you how to create a batch analytics processor and an analyzed message link for your Internet of Things (IoT) application in the Oracle IoT Cloud Service instance.
Background
Your analytics powered IoT application can process, learn, and analyze big volumes of constantly changing data collected from sensors and devices.
The following image illustrates the components of an IoT Application that implements a streaming analytics processor and three batch analytics processors. It also shows the sequence of steps that the components perform with other Oracle Cloud Services and sensor devices to implement the use case. This tutorial covers the bordered area.

You use a batch analytics processor to analyze high volume of batch data that is stored in Oracle NoSQL database or other data sources.
In this tutorial, you create a batch analytics processor that calculates the hourly average engine temperature of an equipment and sends an alert if this average temperature exceeds the standard engine temperature. You also create an analyzed message link to send alerts from a batch analytics processor to your Oracle IoT Cloud Service instance.
What Do You Need?
Access to an instance of Oracle Internet of Things Cloud Service with Analytics
Create an Analyzed Message Link
In this section, you create an analyzed message link that the batch analytics processor uses to send an alert to Oracle IoT Cloud Service. You also create a message format for the alert message.
- Sign in to your instance of Oracle IoT Cloud Service.
- On the Oracle IoT Cloud Service home page, click Menu
, click Applications, and then click Vision Heavy Machines.
- On the Vision Heavy Machines menu, click Analytics, and then click Links.
- Next to the Search Links text box, click Create
.
- On the Create Link page, enter the following values and click Create:
- Name:
temp-alert-aml
- Description:
This link is used to send alerts
- Name:
- On the temp-alert-aml page, in the Type field, select Analyzed Message.
- Next to the Message Format drop down list, click Create
.
- On the Create Message Format page, in the Details section, enter or select the following:
- Name:
temp-alert-aml
- Description:
Message format for sending alert messages
- URN:
urn:com:visionHeavyMachines:iota:tempalertaml
- Message Type: Alert
- Name:
- Expand the Attributes section. click Add
, enter or select the following and click OK:
- Name:
deviceId
- Description:
sensor device ID
- Type: String
- Name:
- To add a few more attributes, repeat the previous step, and enter or select the following values one row at a time:
Name Description Type eventTime
the time when the alert event was generated
Number computedTime
the time when the average event temperature was calculated
Number temperature
the engine temperature of the equipment
Number modelId
the model ID of the heavy machine
String - On the Create Message Format page, click Save.
- On the temp-alert-aml page, in the Message Format drop down list, select
urn:com:visionHeavyMachines:iota:tempalertaml
- On the temp-alert-aml page, notice that in the component diagram an Analytics Object: IACS_ALERTMessage is generated by Oracle IoT Cloud Service and the Classname field is populated with the fully qualified name of the same analytics object.
Description of the illustration aml_page.png
Create a Void Analytics Object
In this section, you create an analytics object that is void. While creating the batch analytics processor, you'll need this object for the parameter field.
- On the Vision Heavy Machines menu, click Analytics, and then click Analytics Objects.
- Next to the Search Analytics Objects text box, click Create
.
- On the Create Analytics Object page, enter or select the following, and click Create:
- Name:
void-ao
- Description:
This analytics object is used as a parameter in a batch analytic processor that calculated the hourly average temperature.
- Name:
- On the void-ao page, in the Type field, select Null.
Create a Batch Analytics Processor
- On the Vision Heavy Machines menu, click Analytics, and then click Analytics Processors.
- Next to the Search Analytics Processors text box, click Create
.
- On the Create Analytics Processor page, enter or select the following, and click Create:
- Name:
hourly-temp-computer-bp
- Description:
This batch analytics processor computes the average temperate of the engine every hour
- Type: Java
- Name:
- On the hourly-temp-computer-bp page, select or enter the following:
- Type: Batch
- Links: sensor-data-nosql, temp-alert-aml, and equipment-model-dbaas
- Implementation Class:
com.visionHeavyMachines.processors.HourlyTempComputerBP
- Parameter (Analytics Object): void-ao
- Resource Path:
hourly-temp-computer-bp-service
- Methods: Get and Post
- Enabled: True
- Click Generate Source Template. Verify that a message Template Generation Successful appears next to the Generate Source Template button.
- On the hourly-temp-computer-bp page, click the Code tab, and review the code. Notice that the code that is generated contains the underlying infrastructure for your batch analytics processor to interact with the links.
Description of the illustration code.png To add functionality to the processor, you modify the
execute()
method either in the Code tab, or in an Integrated Development Environment (IDE).