Deploying AWS IoT Core Connectors

On-premises deployments can use AWS IoT Core to connect data sources to real-time digital twins. Please see the topic AWS IoT Core for detailed information about connecting to AWS IoT Core. This section describes how to use Java APIs to deploy an AWS IoT Core connector to an on-premises deployment of ScaleOut StreamServer instead of to the ScaleOut Digital Twins™ service.

Note

API support for launching an AWS IoT Core connector is currently only available in Java. Messages can be sent to AWS IoT Core using any supported library. However, the connector which receives those messages and processes them for their respective real-time digital twin instance is launched as a Java process. For full API documentation, please see the JavaDocs API Reference.

Prerequisites

As a prerequisite, be sure that Java is installed and the JAVA_HOME environment variable is set. You will need either Gradle or Maven to download the required JARs.

The first step is to create a Java project and set up the classpath using your preferred build tool (Gradle or Maven). The ScaleOut JARs are held in a Maven repository located here: https://repo.scaleoutsoftware.com/repository/external.

For Gradle, add the ScaleOut repository to your build.gradle:

repositories {
        mavenCentral()
        maven {
                url "https://repo.scaleoutsoftware.com/repository/external"
        }
}

Once the repository is added to your build.gradle, add the real-time digital twin APIs as dependencies:

compile group: 'com.scaleoutsoftware.digitaltwin', name: "datasource", version: '1.1.0'

For Maven, add the ScaleOut repository to your pom.xml:

<repository>
        <id>ScaleOut API Repository</id>
        <url>https://repo.scaleoutsoftware.com/repository/external</url>
</repository>

Once the repository is added to your pom.xml, add the real-time digital twin APIs as dependencies:

<dependencies>
        <!-- ... -->
        <!-- your dependencies -->
        <!-- ... -->
        <dependency>
          <groupId>com.scaleoutsoftware.digitaltwin</groupId>
          <artifactId>datasource</artifactId>
          <version>1.1.0</version>
        </dependency>
</dependencies>

Deploying an AWS IoT Core Connector

An AWS IoT Core connector is deployed using the AwsIotEndpointBuilder class to create an AwsIotEndpoint object. It takes the same parameters as the cloud service’s UI; please see Creating an AWS IoT Core Connector for details.

The following code snippet demonstrates how to deploy the connector:

AwsIotEndpoint awsIotEndpoint = new AwsIotEndpointBuilder(
                                connectionName, // a friendly name of this connector
                                clientEndpoint, // the AWS IoT Core endpoint (URI)
                                clientId,       // the client ID used to connect to the AWS IoT core message broker
                                certFilePath,   // the path to the certificate file
                                secretFilePath) // the path to the private key file
                                .load();