Note:
- This tutorial requires access to Oracle Cloud. To sign up for a free account, see Get started with Oracle Cloud Infrastructure Free Tier.
- It uses example values for Oracle Cloud Infrastructure credentials, tenancy, and compartments. When completing your lab, substitute these values with ones specific to your cloud environment.
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
- Collect necessary information from OCI.
- Configure a Kafka node in a ThingsBoard rule chain.
Prerequisites
- Basic knowledge of OCI Streaming, Kafka.
- Understanding of ThingsBoard rule chain.
- User privileges to be able to create and access Streaming resources.
- ThingsBoard installed on a machine. You can find the Community Edition installation steps here.
Task 1: Collect OCI steaming parameters required for integration with a Kafka server
-
If you don’t have already an OCI Stream created, you can follow these steps, to create a new Stream from the console.
-
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
-
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
-
-
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
-
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:
In case the string sasl.jaas.config does not work, there may be an issue with Oracle Identity Cloud Service in the tenancy, so try to use the same from a local user.
Optional: You can also check the Debug mode, for troubleshooting.
Once you update the required values, click on the Checkmark button to save the configuration.
Task 3: Configure the Rule chain
-
“Drag a link” between save timeseries and kafka blocks, so we can forward the saved timeseries to our OCI Stream.
-
Enter Success for the link label.
-
Click on the Checkmark button to save the configuration.
-
Log in to your OCI Console and check the Stream to confirm it is receiving data. Click Load Messages.
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.
Related Links
Acknowledgments
- Adina Nicolescu (Senior Cloud Engineer), Guido Alejandro Ferreyra (Principal Cloud Architect)
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.
Integrate ThingsBoard with OCI Streaming Services
F79939-01
April 2023
Copyright © 2023, Oracle and/or its affiliates.