Tempus Connectors

Provides mqtt and json validation utilities and connectors

License

License

GroupId

GroupId

com.hashmapinc.tempus
ArtifactId

ArtifactId

tempus-connectors
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

Tempus Connectors
Provides mqtt and json validation utilities and connectors
Project URL

Project URL

http://hashmapinc.com

Download tempus-connectors

How to add to project

<!-- https://jarcasting.com/artifacts/com.hashmapinc.tempus/tempus-connectors/ -->
<dependency>
    <groupId>com.hashmapinc.tempus</groupId>
    <artifactId>tempus-connectors</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.hashmapinc.tempus/tempus-connectors/
implementation 'com.hashmapinc.tempus:tempus-connectors:1.0.2'
// https://jarcasting.com/artifacts/com.hashmapinc.tempus/tempus-connectors/
implementation ("com.hashmapinc.tempus:tempus-connectors:1.0.2")
'com.hashmapinc.tempus:tempus-connectors:jar:1.0.2'
<dependency org="com.hashmapinc.tempus" name="tempus-connectors" rev="1.0.2">
  <artifact name="tempus-connectors" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.hashmapinc.tempus', module='tempus-connectors', version='1.0.2')
)
libraryDependencies += "com.hashmapinc.tempus" % "tempus-connectors" % "1.0.2"
[com.hashmapinc.tempus/tempus-connectors "1.0.2"]

Dependencies

compile (3)

Group / Artifact Type Version
org.eclipse.paho : org.eclipse.paho.client.mqttv3 jar 1.2.0
com.fasterxml.jackson.core : jackson-databind jar 2.8.9
org.apache.maven.plugins : maven-gpg-plugin maven-plugin 1.5

provided (1)

Group / Artifact Type Version
org.projectlombok : lombok jar 1.16.18

test (1)

Group / Artifact Type Version
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

Tempus-Connectors

Repo for library that allows kubeless to communicate with Tempus.

There are two utilities provided in this repo:

InputParserUtility

It is used to parse the json data with some mandatory parameters/fields. "id" and either "ts" or "ds" are mandatory parameters in the json. The user can add more fields whose presence he wants to validate. Refer to code snippet. Here "key" is extra field which the user wants to validate.

    import com.hashmapinc.tempus.InputParserUtility;

    InputParserUtility inputParserUtility = new InputParserUtility();
            String jsonStr = "{\"id\":\"1\", \"ts\":1483228800000, \"key\":\"val\"}";
            inputParserUtility.validateJson(jsonStr, Collections.singletonList("key"));

MqttConnector

It is used to publish timeseries and depthseries data to tempus through a gateway device via mqtt. The json format for timeseries data to be published is

    {
      "Device A": [
        {
          "ts": 1483228800000,
          "values": {
            "temperature": 42,
            "humidity": 80
          }
        },
        {
          "ts": 1483228801000,
          "values": {
            "temperature": 43,
            "humidity": 82
          }
        }
      ]
    }

Json format for depthseries data is

    {
      "Device A": [
        {
          "ds": 200.4,
          "values": {
            "temperature": 42,
            "humidity": 80
          }
        },
        {
          "ds": 300.3,
          "values": {
            "temperature": 43,
            "humidity": 82
          }
        }
      ]
    }

Inorder to publish data see the code snippets.

    import com.hashmapinc.tempus.MqttConnector;

Import MqttConnector.

    private static final String MQTT_URL = "tcp://tempus.hashmapinc.com:1883";
    private static final String ACCESS_TOKEN = "DEVICE_GATEWAY_TOKEN";

Give mqtt url and access token of tempus gateway device.

    Optional<Long> empty = Optional.empty();
    String json = "{\"calValue\":\"result\"}";
    new MqttConnector(MQTT_URL, ACCESS_TOKEN).publish(json, empty, Optional.of(200.6), "device_name" + inputData.id);

This will publish depthseries data i.e "json" in above code to a new device whose name is combination of "device_name" and inputData.id. Note: In publish method empty is passed to "ts" long value. When publishing "ds" empty would be passed to "ds" double value.

com.hashmapinc.tempus

HASHMAP INC

Versions

Version
1.0.2
1.0.1
1.0.0