Introducing the ThingWorx Edge Java SDK
The ThingWorx Edge Java SDK is designed for portability while making it easy to integrate applications into the ThingWorx distributed computing view of the Internet of Things (IoT). The goal of the SDK is to make it simple to connect any Java-enabled devices and/or systems to the ThingWorx Platform. In addition, the SDK is designed to give developers enough flexibility to start simple and move quickly to creating highly sophisticated applications.
The SDK allows you to create an application for your machines/devices that communicates with the ThingWorx Platform. The SDK uses the ThingWorx AlwaysOn™ protocol for communication. The AlwaysOn protocol is a binary protocol that leverages WebSockets as its transport mechanism. This protocol allows persistent WebSocket connections that can operate through a firewall. The persistence enables two-way, low latency communication between the device and platform.
Click a section title below to display its content:
Purpose of the Edge Java SDK
The ThingWorx Edge Java SDK contains the required Java libraries (JAR files) for writing a client in Java that is capable of communicating with the ThingWorx Platform. The primary purpose of the ThingWorx Edge Java SDK follows:
• To establish and manage a secure, AlwaysOn connection with a ThingWorx Platform.
• To enable simple programmatic interaction with the properties, services, and events that are exposed by entities that exist on a ThingWorx Platform.
• To easily define properties and services that can be accessed from the ThingWorx Platform.
Requirements
The primary system requirement is that you have installed one of the following versions of the JDK:
• Oracle Java SE 8u271 or later (Oracle subscription required)
• Oracle Java SE 11.0.9 or later (Oracle subscription required)
• OpenJDK 8, such as Oracle OpenJDK 8
• OpenJDK 11, such as Amazon Corretto 11.0.9_12 or Oracle OpenJDK 11
The ThingWorx Edge SDK can run on any device, machine, or system that has one of these Java versions installed.
To build and run the SteamSensor sample application, you will use the Gradle tool that is installed with this SDK
Features
The following features of the ThingWorx Edgw Java SDK allow your application to work with a ThingWorx Platform in single-server mode or in ThingWorx High Availability (HA) Clustering mode:
• Secure Connections — The Java SDK leverages JSSE (Java Secure Socket Extension) and defaults to rejecting self-signed certificates. Certificate validation is supported at the Client and Server, and can optionally be disabled while you are developing a client application. You can also use X.509 certificates.
As of version 7.0, you must pass secrets such as application keys and passwords (proxy or SSL?TLS) to an interface in your application so that it can authenticate with a ThingWorx Platform instance. It is up to you to pass the secret in securely. For more information, refer to
Password Callbacks• Compression — The Java SDK includes version
4.1.15 of Netty to support WebSocket compression at the edge for all WebSocket communications with ThingWorx Platform, including file transfers and tunneling. For more information about compression, refer to
Compression.
• File transfer — The file transfer functionality of the Java SDK allows bidirectional file transfer between an edge device and an instance of ThingWorx Platform.
• Tunneling — The tunneling functionality of the Java SDK allows you to establish secure, firewall-transparent application tunnels for applications that use TCP, such as VNC and SSH.
• Proxy settings — If your environment requires edge devices to communicate through a proxy server, you can set up your application to connect to ThingWorx Platform through a proxy server.
• Properties — Allows devices to easily report changes in property values. These changes can also trigger Events, which can be used to allow the device to respond when property changes occur.