Microsoft Azure IoT SDKs for Java
Help us help you with our IoT SDKs!
We are running a survey through August 2020 to learn more about your IoT projects and support needs. Our team will use this information to help shape the future of our IoT SDKs, and, if you choose to provide your contact information, we'll include you in our circle of advisors for early feedback. Consider spending ~5 minutes completing this survey-- we'd love to hear from you!
Due to security considerations, build logs are not publicly available.
This repository contains the following:
- Azure IoT Hub device SDK for Java: connect client devices to Azure IoT Hub (supports Java 7+)
- Azure IoT Hub service SDK for Java: enables developing back-end applications for Azure IoT (supports Java 8+)
- Azure IoT Device Provisioning device SDK for Java: provision devices to Azure IoT Hub using Azure IoT Device Provisioning
- Azure IoT Device Provisioning service SDK for Java: manage your Provisioning service instance from a back-end Java application
To find SDKs in other languages for Azure IoT, please refer to the azure-iot-sdks repository
Developing applications for Azure IoT
Visit Azure IoT Dev Center to learn more about developing applications for Azure IoT.
How to use the Azure IoT SDKs for Java
Devices and data sources in an IoT solution can range from a simple network-connected sensor to a powerful, standalone computing device. Devices may have limited processing capability, memory, communication bandwidth, and communication protocol support. The IoT device SDKs enable you to implement client applications for a wide variety of devices.
- On Linux and Windows:
- Using Maven: the simplest way to use the Azure IoT SDKs for Java to develop apps is to leverage Maven packages:
- Clone the repository:
git clone https://github.com/Azure/azure-iot-sdk-java.git
- On Android: our Java device SDK can be used on Android using the API version 17 and higher:
- Azure IoT Hub device SDK
- Azure IoT Hub service SDK
- Azure IoT Hub Device Provisioning device SDK
- Azure IoT Hub Device Provisioning service SDK
Key features and roadmap
Device client SDK
|Authentication||Connect your device to IoT Hub securely with supported authentication, including private key, SASToken, X-509 Self Signed over MQTT, AMQPS and HTTPS, and X-509 Certificate Authority (CA) Signed over MQTT and AMQPS.|
|Send device-to-cloud message||Send device-to-cloud messages (max 256KB) to IoT Hub with the option to add custom properties. IoT Hub only supports batch send over AMQP and HTTPS only at the moment. This SDK supports batch send over HTTP. * Batch send over AMQP and AMQP-WS, and add system properties on D2C messages are in progress.|
|Receive cloud-to-device messages||Receive cloud-to-device messages and read associated custom and system properties from IoT Hub, with the option to complete/reject/abandon C2D messages. *C2D message size limit of 256 KB over MQTT and AMQP is in progress. IoT Hub supports the option to complete/reject/abandon C2D messages over HTTPS and AMQP only at the moment.|
|Device Twins||IoT Hub persists a device twin for each device that you connect to IoT Hub. The device can perform operations like get twin tags, subscribe to desired properties. *Send reported properties version and desired properties version are in progress.|
|Direct Methods||IoT Hub gives you the ability to invoke direct methods on devices from the cloud. The SDK supports handler for generic operation.|
|Upload file to Blob||A device can initiate a file upload and notifies IoT Hub when the upload is complete. File upload requires HTTPS connection, but can be initiated from client using any protocol for other operations. *Upload file to Blob with X509 certificate is in progress.|
|Connection Status and Error reporting||Error reporting for IoT Hub supported error code.|
|Retry policies||Retry policy for unsuccessful device-to-cloud messages have three options: no try, exponential backoff with jitter (default) and custom. Detail implementation is documented here.|
|Devices multiplexing over single connection|
|Connection Pooling - Specifying number of connections|
Service client SDK
|Identity registry (CRUD)||Use your backend app to perform CRUD operation for individual device or in bulk.|
|Cloud-to-device messaging||Use your backend app to send cloud-to-device messages in AMQP and AMQP-WS, and set up cloud-to-device message receivers.|
|Direct Methods operations||Use your backend app to invoke direct method on device.|
|Device Twins operations||Use your backend app to perform device twin operations. *Twin reported property update callback and replace twin are in progress.|
|Query||Use your backend app to perform query for information.|
|Jobs||Use your backend app to perform job operation.|
|File Upload||Set up your backend app to send file upload notification receiver.|
Provisioning client SDK
|TPM Individual Enrollment||This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using Trusted Platform Module. Please visit the samples folder and this quickstart on how to create a device client. Websocket connection over AMQP is currently not available. TPM over MQTT is currently not supported by the Device Provisioning Service.|
|X.509 Individual Enrollment||This SDK supports connecting your device to the Device Provisioning Service via individual enrollment using X.509 leaf certificate. Please visit the samples folder and this quickstart on how to create a device client.|
|X.509 Enrollment Group||This SDK supports connecting your device to the Device Provisioning Service via enrollment group using X.509 root certificate. Please visit the samples folder to learn more about this feature.|
Provisioning service client SDK
|CRUD Operation with TPM Individual Enrollment||Programmatically manage device enrollment using TPM with the service SDK. Please visit the samples folder and this quickstart to learn more about this feature.|
|Bulk CRUD Operation with TPM Individual Enrollment||Programmatically bulk manage device enrollment using TPM with the service SDK. Please visit the samples folder to learn more about this feature.|
|CRUD Operation with X.509 Individual Enrollment||Programmatically manage device enrollment using X.509 individual enrollment with the service SDK. Please visit the samples folder and this quickstart to learn more about this feature.|
|CRUD Operation with X.509 Group Enrollment||Programmatically manage device enrollment using X.509 group enrollment with the service SDK. Please visit the samples folder to learn more about this feature.|
|Query enrollments||Programmatically query registration states with the service SDK. Please visit the samples folder to learn more about this feature.|
Within the repository, you can find various types of simple samples that can help you get started.
In order to learn more about logging within this SDK and how to capture its logs, see here
Contribution, feedback and issues
If you encounter any bugs, have suggestions for new features or if you would like to become an active contributor to this project please follow the instructions provided in the contribution guidelines.
- Have a feature request for SDKs? Please post it on User Voice to help us prioritize.
- Have a technical question? Ask on Stack Overflow with tag “azure-iot-hub”
- Need Support? Every customer with an active Azure subscription has access to support with guaranteed response time. Consider submitting a ticket and get assistance from Microsoft support team
- Found a bug? Please help us fix it by thoroughly documenting it and filing an issue on GitHub (C, Java, .NET, Node.js, Python).
Here is what you can expect Microsoft Support to be able to help with:
- Client SDKs issues: If you are trying to compile and run the libraries on a supported platform, the Support team will be able to assist with troubleshooting or questions related to compiler issues and communications to and from the IoT Hub. They will also try to assist with questions related to porting to an unsupported platform, but will be limited in how much assistance can be provided. The team will be limited with trouble-shooting the hardware device itself or drivers and or specific properties on that device.
- IoT Hub / Connectivity Issues: Communication from the device client to the Azure IoT Hub service and communication from the Azure IoT Hub service to the client. Or any other issues specifically related to the Azure IoT Hub.
- Portal Issues: Issues related to the portal, that includes access, security, dashboard, devices, Alarms, Usage, Settings and Actions.
- REST/API Issues: Using the IoT Hub REST/APIs that are documented in the documentation.
- Azure IoT Hub documentation
- Prepare your development environment to use the Azure IoT device SDK for Java
- Setup IoT Hub
- Java SDKs API reference
- Configure TLS Protocol Version and Ciphers
SDK folder structure
This folder contains dependencies that are common across all clients
Contains Azure IoT Hub client components that provide the raw messaging capabilities of the library. Refer to the API documentation and samples for information on how to use it.
This folder contains application development guides and device setup instructions.
This folder contains end to end tests source code for running on jvm and android.
This folder contains scripts to build and run Java SDK provided proper environmental variables are set, as well as azure pipeline resources used for our gating process
Contains libraries that enable interactions with the IoT Hub service to perform operations such as sending messages to devices and managing the device identity registry. Refer to API documentation and samples for more details.
Long Term Support
The project offers a Long Term Support (LTS) version to allow users that do not need the latest features to be shielded from unwanted changes.
A new LTS version will be created every 6 months. The lifetime of an LTS branch is currently planned for one year. LTS branches receive all bug fixes that fall in one of these categories:
- security bugfixes
- critical bugfixes (crashes, memory leaks, etc.)
No new features or improvements will be picked up in an LTS branch.
LTS branches are named lts_mm_yyyy, where mm and yyyy are the month and year when the branch was created. An example of such a branch is lts_07_2017.
Below is a table showing the mapping of the LTS branches to the packages released
|Maven Package||Github Branch||LTS Status||LTS Start Date||Maintenance End Date||Removed Date|
- 1 All scheduled dates are subject to change by the Azure IoT SDK team.
Planned Release Schedule
Microsoft collects performance and usage information which may be used to provide and improve Microsoft products and services and enhance your experience. To learn more, review the privacy statement.