Note:

Integrate ThingsBoard with OCI Streaming Services

Introduction

ThingsBoard is an open-source IoT platform for data collection, processing, visualization, and device management. This tutorial will show the steps you need to follow in order to integrate ThingsBoard with Oracle Cloud Infrastructure (OCI) Streaming services. This way you can store the data in a database, do analytics, use functions to modify and process this information.

Objectives

Prerequisites

Task 1: Collect OCI steaming parameters required for integration with a Kafka server

  1. If you don’t have already an OCI Stream created, you can follow these steps, to create a new Stream from the console.

  2. In case of an existing Stream, note the following information:

    • Open the navigation menu and click Analytics & AI.

    • Under Messaging, click Streaming.

    • Under the Streams tab, open your existing stream and note the Stream Name, for example: thingsboard_stream

    • Click on the Stream Pool link, for example: thingsboard_stream_pool

      Stream pool

    • On the left side menu, go to Kafka Connection Settings, and copy the following information:

      • Bootstrap servers: for example, cell-1.streaming.eu-frankfurt-1.oci.oraclecloud.com:9092

      • SASL Connection Strings: for example, *org.apache.kafka.common.security.plain.PlainLoginModule required username=”/oracleidentitycloudservice//" password="AUTH_TOKEN";*

      • Security Protocol: SASL_SSL

      • Security Mechanism: PLAIN

        Stream information

    • On the top-right corner of the screen, click on the profile icon. UnderUser Profile, click Auth Token, generate a token and copy the value: AUTH_TOKEN, for example: xmo?(cv<abcd….. You can also use an existing token.

Task 2: Configure the Kafka Rule Node

Kafka rule chain

  1. Drag a Kafka Rule Node from the action panel. We will use the information noted in Task 1 to configure the Kafka rule.

    • Name: for example - ThingsBoard2OCIStream

    • Topic pattern: “StreamName”, for example - thingsdemo-s0

    • Bootstrap servers: “Bootstrap servers”, for example - cell-1.streaming.eu-frankfurt-1.oci.oraclecloud.com:9092

    • Other properties: Click Add and add the following key pairs:

      • security.protocol: “Security Protocol” SASL_SSL

      • sasl.mechanism: “Security Mechanism” PLAIN

      • ssl.endpoint.identification.algorithm: https

      • sasl.jaas.config: <SASL Connection Strings:>, for example - *org.apache.kafka.common.security.plain.PlainLoginModule required username=”//" password="AUTH_TOKEN";* (replace AUTH_TOKEN with the value copied in Task 1)

NOTE:

Once you update the required values, click on the Checkmark button to save the configuration.

Task 3: Configure the Rule chain

Rule chain configuration

After the information is received in OCI Streaming, you can use the OCI Service Connector service, for example to transfer it to other services such as OCI Storage, OCI Functions, and so on.

Acknowledgments

More Learning Resources

Explore other labs on docs.oracle.com/learn or access more free learning content on the Oracle Learning YouTube channel. Additionally, visit education.oracle.com/learning-explorer to become an Oracle Learning Explorer.

For product documentation, visit Oracle Help Center.