Coder Social home page Coder Social logo

azure-digital-twins-java's Introduction

Azure Digital Twins (2018) - Java support collection

This project has been developed for the Azure Digital Twins (2018) version and is discontinued.

Azure Digital Twins (2018) is retiring on 31 December 2020. A new version of Azure Digital Twins is available in General Availability and provides new updates that weren't available in the previous version such as:

  • Flexible modelling and general graph topology
  • Richer Compute
  • Bring your own IoT Hub for easier integration
  • Improved scalability

We recommend removing any Azure Digital Twins (2018) resources that are no longer being used and transitioning to the new service as soon as possible, as Azure Digital Twins (2018) resources will no longer be available for use by end of year 2020.

The new Azure Digital Twins provides the capabilities that this project covered originally for Azure Digital Twins (2018).

Please reference the Azure Digital Twins documentation for transitioning into new services.

azure-digital-twins-java's People

Contributors

kaizimmerm avatar mamadaliev avatar microsoftopensource avatar msftgits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

azure-digital-twins-java's Issues

Twin Reflector Proxy - Ingest telemetry with twin context

More details and context see issue: #16

User Story User Story Ingest telemetry with context`

As Cloud Connector,
I want ingest sensor data (points) with context as events asynchronously into ADT,
so that the device and sensor is created or updated in the ADT topology
and the actual telemetry value is reflected in ADT.
and I don't have to worry about the REST management API limitations (e.g. throttling) and the REST API details (e.g. Create or Update).

User Story Details

Ingest sensor data (points) with twin context (including properties, attributes and relationships)

Protocol

Pre-conditions

  • The ontology must be predefined (in ADT version 1 the space types and property-keys are defined)
  • ADT IoT Hub needs to be provision

Event Hub Headers

Please see user story #16

Send telemetry data as event (sensor)

Event Hub Message

Headers:

  • TwinReflectorProxy-MessageType: ingest
  • Source: cbs

Forward all non Twin Reflector Proxy event hub message headers to IoT Hub and prefix them (e.g. TwinReflectorAgent-Source).

Message Payload (Example):

{
  "id": "S1",                               // external Id of the sensor (point)
  "entity-type": "Sensor",
  "attributes": {
     "dataType": "Temperature"
  },
  "properties": [
      {
          "entity-type": "propertykeys",
          "name": "displayName",
          "value": "Temperature XDK"
      }
  ],
  "relationships": [
      {
          "entity-type":     "device",
          "name":            "parent",
          "target-id":       "D1"           // external Id of the device (equipment)
      }
  ],
  "telemetry": "100"                        // any kind of telemetry data
}

Twin Reflector Message Processing

  • Query for the sensor by the external Id
  • Create or update the sensor via the management API
  • Send the telemetry data to the IoT Hub

Twin Reflector Proxy - Ingest topology updates

User Story Ingest twin elements

As Cloud Connector,
I want ingest topology (e.g. spaces) events asynchronously into ADT,
so that the updates are reflected in the ADT topology
and I don't have to worry about the REST management API limitations (e.g. throttling) and the REST API details (e.g. Create or Update).

User Story Details

Ingest twin instances (Create or update) as event asynchronously into ADT including properties, attributes and relationships. The events are processed from Azure Event Hub and mapped into several ADT REST API calls.

The ADT REST API is defined here.

Context Building Block View

twin-reflector_building-block-view

Protocol

Pre-conditions

  • The ontology must be predefined (in ADT version 1 the space types and property-keys are defined)
  • ADT IoT Hub needs to be provision

Event Hub Headers

Header Values Required Description
TwinReflectorProxy-MessageType full, partial, delete yes
TwinReflectorProxy-EventTimestamp e.g. 2018-09-20T07:35:00.8587882-07:00 no timestamp as UTC as ISO 8601 formatted date string that identifies the sampling time of the payload. For example, 2018-09-20T07:35:00.8587882-07:00 (optional)
TwinReflectorProxy-CorrelationId no UUID (optional)

Send event to create or update topology element

The create and update message contains the full state (all attributes, all properties and all relationships) of the topology element!

Event Hub Message

Headers:

  • TwinReflectorProxy-MessageType: ingest

Message Payload (Example):

{
  "id": "F3",                               // external Id
  "entity-type": "Space",
  "attributes": {
     "friendlyName": "Office"
  },
  "properties": [
      {
          "entity-type": "propertykeys",
          "name": "title",
          "value": "Office London"
      }
  ],
  "relationships": [
      {
          "entity-type":     "space",
          "name":            "parent",
          "target-id":       "C1"           // external Id of the campus
      }
  ]
}

Twin Reflector Proxy Message Processing

  • Query for the topology element by the external id (via ADT REST Management API as GET)
  • Apply the attributes and properties from the message (Unit of Work Pattern)
  • Creates or update the element in ADT (via ADT REST Management API as POST or PATCH)
  • Updates the properties of the element in ADT

ADT State (ADT Model V1)

# Space
- id: "7487abd8-a5b9-acab-5fdb-7a74ac1674f5"                  # ADT ID
 - name: "C1"

- id: "5d3600bc-5475-11e9-8647-d663bd873d93"                  # ADT ID
 - name: "F3"
 - friendlyName: "Office"
 - parentId: "7487abd8-a5b9-acab-5fdb-7a74ac1674f5"           # ADT Id parent
 - properties:
    title: "Office London"

Send event to delete a topology element

Event Hub Message

Headers:

  • TwinReflectorProxy-MessageType: delete

Message Payload (Example):

{
  "id": "F3",                               // external Id
}

Twin Reflector Message Processing

  • Query (search) for the topology element by the external Id
  • Delete the topology element
  • Dont't delete other topology elements

Include Sonarcloud check into master build

Currently sonar is generally disabled as it will not work on PRs (Sonar service connection disabled in branch builds).

We should create an extra build for master not based on the pipeline Yaml that is checked in.

Twin Reflector Proxy - Provide PoC implementation

...that verifies that we can sync inbound TRP events into ADT by management API v1.

PoC should proof that create/update/delete calls on a space are ingested into ADT. A framework following UnitOfWork pattern for property and attribute changes as well as parent relationships needs to be defined.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.