ixortalk.iot.client

Common IxorTalk module for IoT integration

License

License

Categories

Categories

CLI User Interface
GroupId

GroupId

com.ixortalk
ArtifactId

ArtifactId

ixortalk.iot.client
Last Version

Last Version

0.0.11
Release Date

Release Date

Type

Type

pom
Description

Description

ixortalk.iot.client
Common IxorTalk module for IoT integration
Project Organization

Project Organization

IxorTalk CVBA

Download ixortalk.iot.client

How to add to project

<!-- https://jarcasting.com/artifacts/com.ixortalk/ixortalk.iot.client/ -->
<dependency>
    <groupId>com.ixortalk</groupId>
    <artifactId>ixortalk.iot.client</artifactId>
    <version>0.0.11</version>
    <type>pom</type>
</dependency>
// https://jarcasting.com/artifacts/com.ixortalk/ixortalk.iot.client/
implementation 'com.ixortalk:ixortalk.iot.client:0.0.11'
// https://jarcasting.com/artifacts/com.ixortalk/ixortalk.iot.client/
implementation ("com.ixortalk:ixortalk.iot.client:0.0.11")
'com.ixortalk:ixortalk.iot.client:pom:0.0.11'
<dependency org="com.ixortalk" name="ixortalk.iot.client" rev="0.0.11">
  <artifact name="ixortalk.iot.client" type="pom" />
</dependency>
@Grapes(
@Grab(group='com.ixortalk', module='ixortalk.iot.client', version='0.0.11')
)
libraryDependencies += "com.ixortalk" % "ixortalk.iot.client" % "0.0.11"
[com.ixortalk/ixortalk.iot.client "0.0.11"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

  • ixortalk-iot-client-spring-boot-autoconfigure
  • ixortalk-iot-client-spring-boot-starter
  • ixortalk-iot-client-spring-boot-core
  • ixortalk-iot-client-spring-boot-aws
  • ixortalk-iot-client-spring-boot-azure-device
  • ixortalk-iot-client-spring-boot-sampleapp

IxorTalk IoT Client

The IxorTalk IoT Client is a Spring Boot library allowing you to connect to the Microsoft Azure and Amazon Web Services IoT offerings.

The library consists of a generic IoT Client (both for sending and receiving messages) and an Azure and AWS implementation This will allow you to connect your Spring Boot application to either Azure IoT HUB or AWS IoT in a matter of seconds. We also provide a sample Spring Boot application showing you how to work with the library.

Cloud IoT offerings

Before you'll be able to use the library, you'll need to register a device on the cloud IoT offering.

Amazon Web Services IoT

Before you'll be able to use the library, you'll need to register a device on AWS IoT. During the creation of a thing in AWS IoT, you'll be prompted to download the x509 certificates (PEM files). Store them somewhere as you'll need them to configure your AWS IoT connection.

Microsoft Azure IoT HUB

If you're using Azure, you'll need to setup an Azure Iot HUB if you haven't done so already and register a device in the IoT hub (don't worry, you don't need a Raspberry PI, you just need to obtain the device connection string. The Spring Boot app running on your computer will act as the device.)

Azure uses a device connection string that you can view in the portal. Take a note of it, as you'll be needing it in the Azure configuration.

Maven Dependencies

This library is published to maven central. In order to use the IoT client, you'll need to add the following maven dependencies

Azure

When using Azure, add the following dependencies:

<dependency>
    <groupId>com.ixortalk</groupId>
    <artifactId>ixortalk-iot-client-spring-boot-starter</artifactId>
    <version>0.0.6</version>
</dependency>
<dependency>
    <groupId>com.microsoft.azure.sdk.iot</groupId>
    <artifactId>iot-device-client</artifactId>
    <version>1.3.32</version>
</dependency>

And make sure you have the following configuration :

ixortalk:
  iot:
    client:
      azure:
        device:
           device-connection-string: "HostName=your-iothub.azure-devices.net;DeviceId=device1;SharedAccessKey=XXXXXXXXXXXXXXXXXXX="

The device connection string can be retrieved from the Azure portal

AWS

When using AWS, add the following dependencies:

<dependency>
    <groupId>com.ixortalk</groupId>
    <artifactId>ixortalk-iot-client-spring-boot-starter</artifactId>
    <version>0.0.6</version>
</dependency>
<dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-iot-device-sdk-java</artifactId>
    <version>1.1.1</version>
</dependency>

And make sure you have the following configuration

ixortalk:
  iot:
    client:
      aws:
        endpoint: yourendpoint.iot.eu-central-1.amazonaws.com
        client-id: ixortalk-iot-client-${random.int}
        default-topic: sdk/test/java
        certificate-file: /etc/aws_iot/certificate.pem.crt
        private-key-file: /etc/aws_iot/private.pem.key

The pem files can be downloaded when you create a thing in the IoT thing registry.

Publishing messages

To publish a message, simply inject the IoTClient bean and call the publish method.

@Inject
private IotClient iotClient;

@PostMapping
@RequestMapping(method = POST, path = "/send")
public ResponseEntity send(@RequestBody String payload) {
    iotClient.publish(payload);
    return ok().build();
}

When working with the AWS implementaton, you can specify an (optional) topic to publish to. The Azure Device SDK does not support user-defined topics.

Receiving messages

Annotate a method with the @IoTListener annotation and start receiving messages. You can optionally specify the topic you want to listen on (only for AWS). If no topic is provided, the AWS implementation will use the default-topic provided in the config.

@IotListener
public void listen(Object message) {
    LOGGER.info("Consumed message: " + message);
}

License

The MIT License (MIT)

Copyright (c) 2016-present IxorTalk CVBA

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
com.ixortalk

IxorTalk

Connected Experiences

Versions

Version
0.0.11
0.0.10
0.0.9
0.0.8
0.0.6