n Creating a Batch Analytics Processor in Oracle IoT Cloud Service

Oracle by Example brandingCreating a Batch Analytics Processor in Oracle IoT Cloud Service

section 0Before 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.

A component diagram of an IoT application powered with analytics
Description of the illustration component_diag.png

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


section 1Create 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.

  1. Sign in to your instance of Oracle IoT Cloud Service.
  2. On the Oracle IoT Cloud Service home page, click Menu Menu, click Applications, and then click Vision Heavy Machines.
  3. On the Vision Heavy Machines menu, click Analytics, and then click Links.
  4. Next to the Search Links text box, click Create Create icon.
  5. On the Create Link page, enter the following values and click Create:
    • Name: temp-alert-aml
    • Description: This link is used to send alerts
  6. On the temp-alert-aml page, in the Type field, select Analyzed Message.
  7. Next to the Message Format drop down list, click Create Create icon.
  8. 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
  9. Expand the Attributes section. click Add Add icon, enter or select the following and click OK:
    • Name: deviceId
    • Description: sensor device ID
    • Type: String
  10. 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
  11. On the Create Message Format page, click Save.
  12. On the temp-alert-aml page, in the Message Format drop down list, select urn:com:visionHeavyMachines:iota:tempalertaml
  13. 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.
    The analyzed message link page
    Description of the illustration aml_page.png

section 2Create 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.

  1. On the Vision Heavy Machines menu, click Analytics, and then click Analytics Objects.
  2. Next to the Search Analytics Objects text box, click Create Create icon.
  3. 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.
  4. On the void-ao page, in the Type field, select Null.

section 3Create a Batch Analytics Processor

  1. On the Vision Heavy Machines menu, click Analytics, and then click Analytics Processors.
  2. Next to the Search Analytics Processors text box, click Create Create icon.
  3. 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
  4. 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
  5. Click Generate Source Template. Verify that a message Template Generation Successful appears next to the Generate Source Template button.
  6. 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.
    The code that is generated
    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).


more informationWant to Learn More?