| <?xml version="1.0" encoding="UTF-8"?> |
| <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> |
| <channel> |
| <title>Eclipse Ditto Blog</title> |
| <description>Announcements, tutorials and examples around Eclipse Ditto and Digital Twins</description> |
| <link>https://www.eclipse.org/ditto/</link> |
| <atom:link href="https://www.eclipse.org/ditto/feed.xml" rel="self" type="application/rss+xml"/> |
| <pubDate>Wed, 30 Oct 2019 02:48:55 -0400</pubDate> |
| <lastBuildDate>Wed, 30 Oct 2019 02:48:55 -0400</lastBuildDate> |
| <generator>Jekyll v3.6.2</generator> |
| |
| <item> |
| <title>Integration of HTTP endpoints/webhooks</title> |
| <description><p>By adding another connectivity type - <a href="connectivity-protocol-bindings-http.html">HTTP</a> - to Ditto’s |
| connectivity, it is now (to be released in the next Ditto milestone 1.0.0-M2) possible to to |
| publish <em>twin events</em>, <em>messages</em>, <em>live commands and events</em> to existing HTTP servers/endpoints.</p> |
| |
| <p>That is especially useful for invoking existing APIs (which are most of the time HTTP based) whenever e.g. |
| a digital twin was modified.</p> |
| |
| <p>One example on how to benefit from this new feature is to invoke a custom |
| <a href="https://ifttt.com">IFTTT</a> (if-this-than-that) <a href="https://ifttt.com/maker_webhooks">webhook</a> via a HTTP <code class="highlighter-rouge">POST</code> request |
| which then may trigger other IFTTT follow-up-actions (e.g. send a chat message to a <a href="https://ifttt.com/slack">Slack</a> |
| room).</p> |
| |
| <p>For IFTTT “webhooks” the address would be <code class="highlighter-rouge">POST https://maker.ifttt.com/trigger/&lt;your-event-name&gt;/with/key/&lt;your-key&gt;</code> |
| and the expected JSON body:</p> |
| |
| <div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> |
| </span><span class="s2">"value1"</span><span class="p">:</span><span class="w"> </span><span class="s2">"..."</span><span class="p">,</span><span class="w"> |
| </span><span class="s2">"value2"</span><span class="p">:</span><span class="w"> </span><span class="s2">"..."</span><span class="p">,</span><span class="w"> |
| </span><span class="s2">"value3"</span><span class="p">:</span><span class="w"> </span><span class="s2">"..."</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span></code></pre></div></div> |
| |
| <p>In combination with <a href="connectivity-mapping.html">payload mapping</a>, the <code class="highlighter-rouge">value1</code> to <code class="highlighter-rouge">value3</code> fields requested by the IFTTT |
| API can be extracted from the <a href="protocol-specification.html">Ditto Protocol</a> and could contain the changed value.</p> |
| |
| <p>In combination with <a href="basic-connections.html#target-topics-and-filtering">filters for targets</a> you can even specify to |
| only publish e.g. <code class="highlighter-rouge">twin events</code>, where the temperature of a twin exceeded a certain threshold:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>{ |
| "address": "POST:/trigger/&lt;your-event-name&gt;/with/key/&lt;your-key&gt;", |
| "topics": [ |
| "_/_/things/twin/events?filter=gt(features/temperature/value,25)" |
| ], |
| ... |
| } |
| </code></pre></div></div> |
| |
| <p>Get creative on which HTTP APIs to trigger based on twin events. E.g. invoke a “function-as-a-service” API or invoke the |
| Twitter API and let your digital twin tweet whenever it detects, that it is getting too warm in your office.</p> |
| |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Thu, 17 Oct 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-10-17-http-connectivity.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-10-17-http-connectivity.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Ditto Milestone 1.0.0-M1a</title> |
| <description><p>Today the Ditto team is happy to announce the first milestone of the upcoming release |
| <a href="https://projects.eclipse.org/projects/iot.ditto/releases/1.0.0">1.0.0</a>.</p> |
| |
| <p>Have a look at the Milestone <a href="release_notes_100-M1a.html">1.0.0-M1a release notes</a> for what changed in detail.</p> |
| |
| <p>The main changes and new features since the last release <a href="release_notes_090.html">0.9.0</a> are</p> |
| |
| <ul> |
| <li>initial contribution of Java client SDK</li> |
| <li>configurable OpenID Connect authorization servers</li> |
| <li>fine grained access for connections</li> |
| <li>scalable event publishing</li> |
| <li>typed entity IDs</li> |
| </ul> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Tue, 17 Sep 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-09-17-milestone-announcement-100-M1a.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-09-17-milestone-announcement-100-M1a.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Eclipse Ditto now supports OpenID Connect</title> |
| <description><p>Eclipse Ditto now supports all OAuth 2.0 providers which implement <a href="https://openid.net/connect/">OpenID Connect</a> out-of-the-box. |
| You can find a list of certified providers at <a href="https://openid.net/developers/certified/">OpenID Connect - Certified OpenID Provider Servers and Services</a>.</p> |
| |
| <p>With this post, we want to give an example of this new feature using the open source provider <a href="https://www.ory.sh">ORY Hydra</a>. |
| Follow their <a href="https://www.ory.sh/docs/next/hydra/configure-deploy#installing-ory-hydra">installation guide</a> for a |
| docker based setup on your development machine.</p> |
| |
| <h4 id="configuration">Configuration</h4> |
| <p>Download the self-signed certificate form the ORY Hydra server: https://localhost:9000/.well-known/openid-configuration</p> |
| |
| <p>Use the downloaded certificate for the akka-http ssl configuration.</p> |
| <pre><code class="language-hocon">ssl-config { |
| trustManager = { |
| stores = [ |
| { type = "PEM", path = "/path/to/cert/globalsign.crt" } |
| ] |
| } |
| } |
| </code></pre> |
| |
| <p>The authentication provider must be added to the ditto-gateway configuration.</p> |
| <pre><code class="language-hocon">ditto.gateway.authentication { |
| oauth { |
| openid-connect-issuers = { |
| ory = "https://localhost:9000/" |
| } |
| } |
| } |
| </code></pre> |
| |
| <p>The configured subject-issuer will be used to prefix the value of the “sub” claim, e.g.</p> |
| <div class="language-json highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="p">{</span><span class="w"> |
| </span><span class="s2">"subjects"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> |
| </span><span class="s2">"ory:foo@bar.com"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w"> |
| </span><span class="s2">"type"</span><span class="p">:</span><span class="w"> </span><span class="s2">"generated"</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span><span class="p">}</span><span class="w"> |
| </span></code></pre></div></div> |
| |
| <h4 id="authenticate-ditto-api">Authenticate Ditto API</h4> |
| <p>Create an OAuth client with hydra to be able to create ID Tokens.</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker run <span class="nt">--rm</span> <span class="nt">-it</span> <span class="se">\</span> |
| <span class="nt">-e</span> <span class="nv">HYDRA_ADMIN_URL</span><span class="o">=</span>https://ory-hydra-example--hydra:4445 <span class="se">\</span> |
| <span class="nt">--network</span> hydraguide <span class="se">\</span> |
| oryd/hydra:v1.0.0 <span class="se">\</span> |
| clients create <span class="nt">--skip-tls-verify</span> <span class="se">\</span> |
| <span class="nt">--id</span> eclipse-ditto <span class="se">\</span> |
| <span class="nt">--secret</span> some-secret <span class="se">\</span> |
| <span class="nt">--grant-types</span> authorization_code,refresh_token,client_credentials,implicit <span class="se">\</span> |
| <span class="nt">--response-types</span> token,code,id_token <span class="se">\</span> |
| <span class="nt">--scope</span> openid,offline <span class="se">\</span> |
| <span class="nt">--callbacks</span> http://127.0.0.1:9010/callback |
| </code></pre></div></div> |
| |
| <p>Use the client to generate an ID Token.</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>docker run <span class="nt">--rm</span> <span class="nt">-it</span> <span class="se">\</span> |
| <span class="nt">--network</span> hydraguide <span class="se">\</span> |
| <span class="nt">-p</span> 9010:9010 <span class="se">\</span> |
| oryd/hydra:v1.0.0 <span class="se">\</span> |
| token user <span class="nt">--skip-tls-verify</span> <span class="se">\</span> |
| <span class="nt">--port</span> 9010 <span class="se">\</span> |
| <span class="nt">--auth-url</span> https://localhost:9000/oauth2/auth <span class="se">\</span> |
| <span class="nt">--token-url</span> https://ory-hydra-example--hydra:4444/oauth2/token <span class="se">\</span> |
| <span class="nt">--client-id</span> eclipse-ditto <span class="se">\</span> |
| <span class="nt">--client-secret</span> some-secret <span class="se">\</span> |
| <span class="nt">--scope</span> openid |
| </code></pre></div></div> |
| <p>After that perform the OAuth 2.0 Authorize Code Flow by opening the link, as prompted, |
| in your browser, and follow the steps shown there.</p> |
| |
| <p>Use the generated token to authenticate Ditto API.</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST <span class="se">\</span> |
| http://localhost:8080/api/2/things <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'Authorization: Bearer &lt;JWT&gt;'</span> <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="se">\</span> |
| <span class="nt">-d</span> <span class="s1">'{}'</span> |
| </code></pre></div></div> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 28 Aug 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-08-28-openid-connect.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-08-28-openid-connect.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Eclipse Ditto Release 0.9.0</title> |
| <description><p>Today the Eclipse Ditto team proudly presents its second release |
| <a href="https://projects.eclipse.org/projects/iot.ditto/releases/0.9.0">0.9.0</a>.</p> |
| |
| <p>The topics of this release in a nutshell were:</p> |
| |
| <ul> |
| <li>Memory improvements for huge amounts (multi million) of digital twins which are held in memory</li> |
| <li>Adding metrics and logging around the connectivity feature in order to enable being able to operate connections to foreign systems/brokers via APIs</li> |
| <li>Enhancing Ditto’s connectivity feature by additionally being able to connect to Apache Kafka</li> |
| <li>Performance improvements of Ditto’s search functionality</li> |
| <li>Stabilization of cluster bootstrapping</li> |
| <li>Refactoring of how the services configurations are determined</li> |
| <li>Addition of a Helm template in order to simplify Kubernetes based deployments</li> |
| <li>Contributions from Microsoft in order to ease operating Eclipse Ditto on Microsoft Azure</li> |
| </ul> |
| |
| <p>Please have a look at the <a href="release_notes_090.html">0.9.0 release notes</a> for a more detailed information on the release.</p> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 10 Jul 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-07-10-release-announcement-090.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-07-10-release-announcement-090.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Ditto Milestone 0.9.0-M2</title> |
| <description><p>The second milestone of the upcoming release |
| <a href="https://projects.eclipse.org/projects/iot.ditto/releases/0.9.0">0.9.0</a> was released today.</p> |
| |
| <p>Have a look at the Milestone <a href="release_notes_090-M2.html">0.9.0-M2 release notes</a> for what changed in detail.</p> |
| |
| <p>The main changes and new features since the last milestone <a href="release_notes_090-M1.html">0.9.0-M1</a> are</p> |
| |
| <ul> |
| <li>rewrite of Ditto’s “search” service in order to use the same index and have the same query performance for API v1 and v2</li> |
| <li>several contributions in order to operate Eclipse Ditto on Microsoft Azure</li> |
| </ul> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Mon, 29 Apr 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-04-29-milestone-announcement-090-M2.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-04-29-milestone-announcement-090-M2.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Ditto Milestone 0.9.0-M1</title> |
| <description><p>Today the Ditto team is happy to announce the first milestone of the upcoming release |
| <a href="https://projects.eclipse.org/projects/iot.ditto/releases/0.9.0">0.9.0</a>.</p> |
| |
| <p>Have a look at the Milestone <a href="release_notes_090-M1.html">0.9.0-M1 release notes</a> for what changed in detail.</p> |
| |
| <p>The main changes and new features since the last release <a href="release_notes_080.html">0.8.0</a> are</p> |
| |
| <ul> |
| <li>memory optimizations when working with millions of digital twins</li> |
| <li>enhance connectivity to also be able to establish connections to Apache Kafka</li> |
| <li>providing more detailed metrics for connections</li> |
| <li>cluster bootstrapping stability improvements</li> |
| </ul> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Thu, 28 Mar 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-03-28-milestone-announcement-090-M1.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-03-28-milestone-announcement-090-M1.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Connectivity to Apache Kafka in Eclipse Ditto</title> |
| <description><p>Today we added connectivity to <a href="https://kafka.apache.org/">Apache Kafka</a>. In a first step, it is possible to publish |
| <em>twin events</em>, <em>messages</em>, <em>live commands and events</em> to Kafka topics.</p> |
| |
| <p>Since the last addition to Ditto’s connectivity which <a href="2018-10-16-example-mqtt-bidirectional.html">added MQTT connectivity</a>, |
| the connectivity feature got a lot of stabilization and new smaller features, e.g. the recent addition of |
| <a href="basic-placeholders.html#function-expressions">placeholder functions</a>.</p> |
| |
| <p>Returning to the Kafka integration Ditto can now, for example, whenever a <a href="intro-digitaltwins.html">digital twin</a> is |
| changed (e.g. a device updated some state data), publish a <em>twin event</em> to a Kafka topic.</p> |
| |
| <p>If you already rely on Apache Kafka as a source for your data lake or analytics, integrating Ditto and its digital twins |
| is now super easy.</p> |
| |
| <p>Find out more at our <a href="connectivity-protocol-bindings-kafka2.html">Kafka documentation</a>.</p> |
| |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 13 Mar 2019 00:00:00 -0400</pubDate> |
| <link>https://www.eclipse.org/ditto/2019-03-13-kafka-connectivity.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2019-03-13-kafka-connectivity.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Using Eclipse Hono's Command&Control with Eclipse Ditto</title> |
| <description><p>With <a href="release_notes_080.html">version 0.8.0</a> Eclipse Ditto can now interact with Eclipse Hono using the |
| “Command &amp; Control” feature. It is possible to send a |
| Thing (or Feature) message at the Ditto Message API, which is then forwarded to Hono as a |
| command message. Hono routes the message to the device, which in turn can send a response to the command including a |
| status, telling if the command was successfully processed or not. |
| This response is routed back via Hono to the Ditto Message API.</p> |
| |
| <p>In this example we connect the <a href="https://ditto.eclipse.org/">Ditto sandbox</a> and the |
| <a href="https://www.eclipse.org/hono/sandbox/">Hono sandbox</a> to send a message (3) to a simulated device via the |
| Ditto Messages API. The device receives the command from the Hono HTTP Adapter and responds with a message (4) |
| that is routed back to the caller at the Ditto Message API (5). For the sake of simplicity we use simple curl |
| commands both for the Ditto and Hono HTTP APIs.</p> |
| |
| <p>The following steps are covered in this example:</p> |
| |
| <ol> |
| <li>Setup a connection between Eclipse Ditto and Hono sandboxes</li> |
| <li>Signal availability of the device</li> |
| <li>Send a Ditto message</li> |
| <li>Device receives command and sends command response</li> |
| <li>Caller receives response at Ditto Message API</li> |
| </ol> |
| |
| <p><img src="images/blog/2018-12-14-command-and-control.png" alt="Command and Control" /></p> |
| |
| <h3 id="prerequisites-a-ditto-digital-twin-and-a-hono-device">Prerequisites: A Ditto digital twin and a Hono device</h3> |
| |
| <p>The creation of a Hono device and Ditto digital twin has already been covered in the blog post |
| <a href="2018-05-02-connecting-ditto-hono.html">Connecting Eclipse Ditto to Eclipse Hono</a>. For brevity we will just list the |
| required commands to create a twin/device here. For a detailed explanation of the steps please refer to the previous |
| post.</p> |
| |
| <h4 id="create-hono-device">Create Hono device</h4> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># setup a tenant</span> |
| <span class="nv">$ </span>curl <span class="nt">-X</span> POST <span class="nt">-i</span> <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{"tenant-id": "org.eclipse.ditto"}'</span> http://hono.eclipse.org:28080/tenant |
| <span class="c"># create a device</span> |
| <span class="nv">$ </span>curl <span class="nt">-X</span> POST <span class="nt">-i</span> <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{"device-id": "org.eclipse.ditto:teapot"}'</span> http://hono.eclipse.org:28080/registration/org.eclipse.ditto |
| <span class="c"># add device credentials</span> |
| <span class="nv">$ PWD_HASH</span><span class="o">=</span><span class="k">$(</span><span class="nb">echo</span> <span class="nt">-n</span> <span class="s1">'teapot'</span> | openssl dgst <span class="nt">-binary</span> <span class="nt">-sha512</span> | base64 <span class="nt">-w</span> 0<span class="k">)</span> |
| <span class="nv">$ </span>curl <span class="nt">-X</span> POST <span class="nt">-i</span> <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{ |
| "device-id": "org.eclipse.ditto:teapot", |
| "type": "hashed-password", |
| "auth-id": "teapot", |
| "secrets": [{ |
| "hash-function" : "sha-512", |
| "pwd-hash": "'</span><span class="nv">$PWD_HASH</span><span class="s1">'" |
| }] |
| }'</span> http://hono.eclipse.org:28080/credentials/org.eclipse.ditto |
| </code></pre></div></div> |
| |
| <h4 id="create-ditto-policy-for-digital-twin">Create Ditto policy for digital twin</h4> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># create policy in Ditto</span> |
| <span class="nv">$ </span>curl <span class="nt">-X</span> PUT <span class="nt">-i</span> <span class="nt">-u</span> demo5:demo <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{ |
| "policyId": "org.eclipse.ditto:teapot-policy", |
| "entries": { |
| "DEMO": { |
| "subjects": { |
| "nginx:demo5": { |
| "type": "basic auth user and user used in connection'</span>s authorizationContext<span class="s2">" |
| } |
| }, |
| "</span>resources<span class="s2">": { |
| "</span>thing:/<span class="s2">": { |
| "</span>grant<span class="s2">": ["</span>READ<span class="s2">", "</span>WRITE<span class="s2">"], |
| "</span>revoke<span class="s2">": [] |
| }, |
| "</span>policy:/<span class="s2">": { |
| "</span>grant<span class="s2">": ["</span>READ<span class="s2">", "</span>WRITE<span class="s2">"], |
| "</span>revoke<span class="s2">": [] |
| }, |
| "</span>message:/<span class="s2">": { |
| "</span>grant<span class="s2">": ["</span>READ<span class="s2">", "</span>WRITE<span class="s2">"], |
| "</span>revoke<span class="s2">": [] |
| } |
| } |
| } |
| } |
| }' https://ditto.eclipse.org/api/2/policies/org.eclipse.ditto:teapot-policy |
| </span></code></pre></div></div> |
| |
| <h4 id="create-ditto-digital-twin">Create Ditto digital twin</h4> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="c"># create thing in Ditto</span> |
| <span class="nv">$ </span>curl <span class="nt">-X</span> PUT <span class="nt">-i</span> <span class="nt">-u</span> demo5:demo <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="nt">-d</span> <span class="s1">'{ |
| "policyId": "org.eclipse.ditto:teapot-policy", |
| "features": { |
| "water": { |
| "properties": { |
| "temperature": 20 |
| } |
| } |
| } |
| }'</span> https://ditto.eclipse.org/api/2/things/org.eclipse.ditto:teapot |
| </code></pre></div></div> |
| |
| <h3 id="setup-a-connection-for-command--control">Setup a connection for Command &amp; Control</h3> |
| <p>In order to forward Ditto Messages to the device as a Hono command we first need to setup and configure a |
| <a href="connectivity-manage-connections.html">connection</a> between Eclipse Ditto and Eclipse Hono that is prepared for |
| <em>Command &amp; Control</em> messages. According to the |
| <a href="https://www.eclipse.org/hono/">Hono documentation</a> |
| the connection must contain a target with the address <code class="highlighter-rouge">control/&lt;tenant-id&gt;/&lt;device-id&gt;</code> |
| and a source with the address <code class="highlighter-rouge">control/&lt;tenant-id&gt;/&lt;reply-identifier&gt;</code>. The <code class="highlighter-rouge">reply-identifier</code> can be |
| chosen arbitrarily, but must be set as the <code class="highlighter-rouge">reply-to</code> header of a command exactly as defined in the connection:</p> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST <span class="nt">-i</span> <span class="nt">-u</span> devops:devopsPw1! <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="se">\</span> |
| <span class="nt">-d</span> <span class="s1">'{ |
| "targetActorSelection": "/system/sharding/connection", |
| "headers": { |
| "aggregate": false |
| }, |
| "piggybackCommand": { |
| "type": "connectivity.commands:createConnection", |
| "connection": { |
| "id": "command-and-control-connection", |
| "connectionType": "amqp-10", |
| "connectionStatus": "open", |
| "uri": "amqp://consumer%40HONO:verysecret@hono.eclipse.org:15672", |
| "failoverEnabled": true, |
| "sources": [{ |
| "addresses": [ |
| "control/org.eclipse.ditto/replies" |
| ], |
| "authorizationContext": [ |
| "nginx:demo5" |
| ], |
| "headerMapping": { |
| "correlation-id": "{{ header:correlation-id }}", |
| "status": "{{ header:status }}", |
| "content-type": "{{ header:content-type }}" |
| } |
| } |
| ], |
| "targets": [{ |
| "address": "control/org.eclipse.ditto/{{ thing:name }}", |
| "authorizationContext": [ |
| "nginx:demo5" |
| ], |
| "topics":["_/_/things/live/messages"], |
| "headerMapping": { |
| "message-id": "{{ header:correlation-id }}", |
| "subject": "{{ topic:subject }}", |
| "content-type": "application/vnd.eclipse.ditto+json", |
| "reply-to": "control/org.eclipse.ditto/replies" |
| } |
| } |
| ] |
| } |
| } |
| }'</span> <span class="se">\</span> |
| https://ditto.eclipse.org/devops/piggyback/connectivity?timeout<span class="o">=</span>10000 |
| </code></pre></div></div> |
| |
| <p>As described in the |
| <a href="https://www.eclipse.org/hono/">Hono API description</a> |
| a command message has three mandatory properties: <code class="highlighter-rouge">correlation-id</code>, <code class="highlighter-rouge">subject</code> and <code class="highlighter-rouge">reply-to</code>, these are defined in the |
| target header mapping of the connection. |
| The source header mapping defines a mapping for <code class="highlighter-rouge">correlation-id</code> and <code class="highlighter-rouge">status</code> to internal headers, they are required |
| to properly map the Hono command response to a Ditto message response.</p> |
| |
| <h3 id="signal-availability-of-device">Signal availability of device</h3> |
| |
| <p>As we are using the Hono HTTP Adapter to connect our device, send telemetry and receive commands, the designated way |
| is therefor to signal readiness to receive a command by specifying the <code class="highlighter-rouge">hono-ttd</code> parameter on an arbitrary event (for |
| detailed description please consult the |
| [Hono HTTP Adapter] (https://www.eclipse.org/hono/) |
| guide).</p> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-X</span> POST <span class="nt">-i</span> <span class="nt">-u</span> teapot@org.eclipse.ditto:teapot <span class="nt">-H</span> <span class="s1">'hono-ttd: 60'</span> <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="se">\</span> |
| <span class="nt">-d</span> <span class="s1">'{ |
| "topic": "org.eclipse.ditto/teapot/things/twin/commands/modify", |
| "path": "/features/water/properties/temperature", |
| "value": 23 |
| }'</span> <span class="se">\</span> |
| http://hono.eclipse.org:8080/telemetry |
| </code></pre></div></div> |
| |
| <p>The request is now open to receive a command for 60 seconds before it is terminated.</p> |
| |
| <h3 id="send-a-ditto-message">Send a Ditto message</h3> |
| |
| <p>Now we can use the <a href="protocol-specification-things-messages.html#using-the-messages-api">Ditto Messages API</a> to send a |
| message to the device waiting for a command:</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-i</span> <span class="nt">-X</span> POST <span class="s1">'https://ditto.eclipse.org/api/2/things/org.eclipse.ditto:teapot/inbox/messages/brew?timeout=60'</span> <span class="se">\</span> |
| <span class="nt">-u</span> demo5:demo <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'x-correlation-id: command-and-control'</span> <span class="se">\</span> |
| <span class="nt">-d</span> <span class="s1">'{"targetTemperature":85}'</span> |
| </code></pre></div></div> |
| |
| <h3 id="device-receives-the-command">Device receives the command</h3> |
| |
| <p>The message is forwarded to Hono as configured in the connection and finally terminates the pending request we opened |
| before with a status code of <code class="highlighter-rouge">200 OK</code>:</p> |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>HTTP/1.1 200 OK |
| hono-command: brew |
| hono-cmd-req-id: 013command-and-controlreplies |
| Content-Type: application/octet-stream |
| Content-Length: 17 |
| Connection: Keep-Alive |
| </code></pre></div></div> |
| |
| <p>Hono adds two headers besides the standard HTTP headers: <code class="highlighter-rouge">hono-command</code> and <code class="highlighter-rouge">hono-cmd-req-id</code>. |
| <code class="highlighter-rouge">hono-command</code> contains the subject of the message and <code class="highlighter-rouge">hono-cmd-req-id</code> identifies the messages and is used to |
| correlate the request and the response we are now going to send.</p> |
| |
| <h3 id="device-sends-a-command-response">Device sends a command response</h3> |
| |
| <p>We use the header value of <code class="highlighter-rouge">hono-cmd-req-id</code> to construct the response address: |
| <code class="highlighter-rouge">http://hono.eclipse.org:8080/control/res/013command-and-controlreplies</code></p> |
| |
| <p>Another curl command completes the roundtrip with a response from the simulated device:</p> |
| |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>curl <span class="nt">-i</span> <span class="nt">-X</span> POST <span class="nt">-u</span> teapot@org.eclipse.ditto:teapot <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'Content-Type: application/json'</span> <span class="se">\</span> |
| <span class="nt">-H</span> <span class="s1">'hono-cmd-status: 200'</span> <span class="se">\</span> |
| <span class="nt">-d</span> <span class="s1">'{ |
| "topic": "org.eclipse.ditto/teapot/things/live/messages/brew", |
| "headers": { |
| "content-type": "application/json", |
| "correlation-id": "command-and-control" |
| }, |
| "path": "/inbox/messages/brew", |
| "value": { "eta": 56}, |
| "status": 200 |
| }'</span> <span class="se">\</span> |
| http://hono.eclipse.org:8080/control/res/013command-and-controlreplies |
| </code></pre></div></div> |
| |
| <h3 id="message-response-is-received-at-ditto-message-api">Message response is received at Ditto Message API</h3> |
| <p>And finally we receive the command response at the Ditto Message API where we sent the original message:</p> |
| |
| <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>HTTP/1.1 200 OK |
| correlation-id: command-and-control |
| message-id: command-and-control |
| status: 200 |
| Content-Type: application/json |
| Content-Length: 10 |
| |
| {"eta":56} |
| </code></pre></div></div> |
| |
| <h3 id="alternative-receive-command-and-send-response-via-mqtt">Alternative: Receive command and send response via MQTT</h3> |
| |
| <p>Alternatively we can also receive the command by subscribing to the MQTT topic <code class="highlighter-rouge">control/+/+/req/#</code> at the |
| <a href="https://www.eclipse.org/hono/">Hono MQTT Adapter</a>:</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code><span class="nv">$ </span>mosquitto_sub <span class="nt">-d</span> <span class="nt">-h</span> hono.eclipse.org <span class="nt">-p</span> 8883 <span class="nt">-v</span> <span class="nt">-u</span> <span class="s1">'teapot@org.eclipse.ditto'</span> <span class="nt">-P</span> teapot <span class="nt">-t</span> <span class="s1">'control/+/+/req/#'</span> |
| </code></pre></div></div> |
| |
| <p>And also publish the command response on the MQTT topic <code class="highlighter-rouge">control///res/013command-and-controlreplies/200</code>:</p> |
| <div class="language-bash highlighter-rouge"><div class="highlight"><pre class="highlight"><code>mosquitto_pub <span class="nt">-d</span> <span class="nt">-h</span> hono.eclipse.org <span class="nt">-p</span> 8883 <span class="nt">-u</span> <span class="s1">'teapot@org.eclipse.ditto'</span> <span class="nt">-P</span> teapot <span class="se">\</span> |
| <span class="nt">-t</span> control///res/013command-and-controlreplies/200 <span class="se">\</span> |
| <span class="nt">-m</span> <span class="s1">'{ |
| "topic": "org.eclipse.ditto/teapot/things/live/messages/brew", |
| "headers": { |
| "content-type": "application/json", |
| "correlation-id": "command-and-control" |
| }, |
| "path": "/inbox/messages/brew", |
| "value": { |
| "eta": 58 |
| }, |
| "status": 200 |
| }'</span> |
| </code></pre></div></div> |
| |
| <p>If you have any wishes, improvements, are missing something |
| or just want to get in touch with us, you can use one of |
| our <a href="feedback.html">feedback channels</a>.</p> |
| |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 05 Dec 2018 00:00:00 -0500</pubDate> |
| <link>https://www.eclipse.org/ditto/2018-12-05-example-command-and-control.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2018-12-05-example-command-and-control.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Eclipse Ditto Release 0.8.0</title> |
| <description><p>Today the Eclipse Ditto team proudly presents its first release |
| <a href="https://projects.eclipse.org/projects/iot.ditto/releases/0.8.0">0.8.0</a>.</p> |
| |
| <p>Please have a look at the <a href="release_notes_080.html">0.8.0 release notes</a> for a more detailed information on the release.</p> |
| |
| <p>The main changes and new features since the latest milestone <a href="release_notes_080-M3.html">0.8.0-M3</a> are:</p> |
| |
| <ul> |
| <li>Support Eclipse Hono’s command&amp;control in Ditto connectivity</li> |
| <li>several smaller bugfixes</li> |
| </ul> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 28 Nov 2018 00:00:00 -0500</pubDate> |
| <link>https://www.eclipse.org/ditto/2018-11-28-release-announcement-080.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2018-11-28-release-announcement-080.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| <item> |
| <title>Announcing Ditto Milestone 0.8.0-M3</title> |
| <description><p>Preparing the upcoming first release <a href="https://projects.eclipse.org/projects/iot.ditto/releases/0.8.0">0.8.0</a> of |
| Eclipse Ditto, this milestone is a last checkpoint to ensure that the release will be performed smoothly.<br /> |
| Therefore, this milestone release primarily focuses on stabilization.</p> |
| |
| <p>Have a look at the Milestone <a href="release_notes_080-M3.html">0.8.0-M3 release notes</a> for what changed in detail.</p> |
| |
| <div class="alert alert-danger" role="alert"><i class="fa fa-exclamation-circle"></i> <b>Warning:</b> If you want to upgrade an existing Ditto installation, you’ll have to execute a small |
| database migration - see release notes.</div> |
| |
| <p>The main changes and new features are</p> |
| |
| <ul> |
| <li>speed up of search index creation</li> |
| <li>applying enforcement of messages received via connections (e.g. from Eclipse Hono)</li> |
| <li>copying already existing policies when creating things</li> |
| </ul> |
| |
| <h2 id="artifacts">Artifacts</h2> |
| |
| <p>The new Java artifacts have been published at the <a href="https://repo.eclipse.org/content/repositories/ditto/">Eclipse Maven repository</a> |
| as well as <a href="https://repo1.maven.org/maven2/org/eclipse/ditto/">Maven central</a>.</p> |
| |
| <p>The Docker images have been pushed to Docker Hub:</p> |
| <ul> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-policies/">eclipse/ditto-policies</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things/">eclipse/ditto-things</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-things-search/">eclipse/ditto-things-search</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-gateway/">eclipse/ditto-gateway</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-connectivity/">eclipse/ditto-connectivity</a></li> |
| <li><a href="https://hub.docker.com/r/eclipse/ditto-concierge/">eclipse/ditto-concierge</a></li> |
| </ul> |
| |
| <p><br /> |
| <br /></p> |
| <figure><img class="docimage" src="images/ditto.svg" alt="Ditto" style="max-width: 500px" /></figure> |
| |
| <p>–<br /> |
| The Eclipse Ditto team</p> |
| </description> |
| <pubDate>Wed, 14 Nov 2018 00:00:00 -0500</pubDate> |
| <link>https://www.eclipse.org/ditto/2018-11-14-milestone-announcement-080-M3.html</link> |
| <guid isPermaLink="true">https://www.eclipse.org/ditto/2018-11-14-milestone-announcement-080-M3.html</guid> |
| |
| <category>blog</category> |
| |
| |
| </item> |
| |
| </channel> |
| </rss> |