Use Device Message Links to Read Device Data

Use device message links to receive data from devices that you registered in Oracle Internet of Things Cloud Service.

Before creating a creating a link to read your device messages, ensure you associated the device models for your devices to your IoT application.
  1. Go to your IoT application, select Analytics, and then select Links.
  2. Create the link:
    1. If this is your first link, click Create Link. Otherwise, click Add next to the Search field.
    2. Enter a name to identify your link.
      The name must only contain alphanumeric characters and must not contain spaces.
    3. (Optional) Enter a brief description.
    4. Click Create.
  3. From the Type list, select Device Message.
  4. From the Message Format list, select an existing message format.
    The available message formats depend on the device models associated with your IoT application. Each device model defines a default message format for the attributes, and you can add custom message formats by adding custom data messages to your device model. To learn more about device models, see Creating a New Device Model.
  5. From the Annotations list, add at least one annotation.
    Annotations contain device metadata either automatically generated, or that you provide when registering your devices. For more information, see Adding and Editing Device Metadata.
  6. Define how to parallelize the processing of the device messages:
    1. In the Partition Count field, select a number between 1 and 10 that defines the degree of parallelism.
    2. In the Partition Key list, select the key to use to partition the messages.
  7. (Optional) Select Use from Worksheets to be able to query this link from the queries in your worksheets.
    If you select this option, then you can use this link in the from clause of your query.
    For example:
    select * from MyLink
  8. Click Save.
After you save the device message link, the classname field now shows the automatically generated fully qualified named for the Java class that corresponds to this message format. You can use this Java class from the code of your analytics processor.
If you create a new analytics processor and select this link, the source template you generate from the analytics processor will contain a line of code that injects this link into the analytics processor. The instance attribute to access this link is named using the name of the link preceded by the prefix input_ and is of the type JavaDStream<DATAMessage>.