blob: f1048617c7f8215a71600d175801b8f4be3e684e [file] [log] [blame]
<!DOCTYPE html>
<html lang="stable" class="js csstransforms3d">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Hugo 0.54.0" />
<meta name="description" content="A set of micro-services for connecting millions of devices.">
<meta name="author" content="The Eclipse Hono Project">
<link rel="apple-touch-icon" sizes="180x180" href="/hono/docs/favicon/apple-touch-icon.png">
<link rel="icon" type="image/png" sizes="48x48" href="/hono/docs/favicon/favicon-48x48.png">
<link rel="icon" type="image/png" sizes="32x32" href="/hono/docs/favicon/favicon-32x32.png">
<link rel="icon" type="image/png" sizes="16x16" href="/hono/docs/favicon/favicon-16x16.png">
<link rel="manifest" href="/hono/docs/favicon/site.webmanifest">
<link rel="mask-icon" href="/hono/docs/favicon/safari-pinned-tab.svg" color="#5bbad5">
<link rel="shortcut icon" href="/hono/docs/favicon/favicon.ico">
<meta name="msapplication-TileColor" content="#da532c">
<meta name="msapplication-config" content="/hono/docs/favicon/browserconfig.xml">
<meta name="theme-color" content="#ffffff">
<title>Command & Control :: Eclipse Hono&trade;</title>
<link href="/hono/docs/css/nucleus.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/fontawesome-all.min.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/hybrid.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/featherlight.min.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/perfect-scrollbar.min.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/auto-complete.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/theme.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/hugo-theme.css?1569029010" rel="stylesheet">
<link href="/hono/docs/css/theme-hono.css?1569029010" rel="stylesheet">
<script src="/hono/docs/js/jquery-2.x.min.js?1569029010"></script>
<style type="text/css">
:root #header + #content > #left > #rlblock_left{
display:none !important;
}
:not(pre) > code + span.copy-to-clipboard {
display: none;
}
</style>
<link rel="stylesheet" href="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/stylesheets/vendor/cookieconsent/cookieconsent.min.css">
<link rel="stylesheet" href='/hono/docs/css/hono.css'>
<meta name="twitter:card" content="summary_large_image">
<meta name="twitter:site" content="@EclipseHono">
<meta name="twitter:title" content="Command &amp; Control :: Eclipse Hono&amp;trade;">
<meta name="twitter:image" content="https://www.eclipse.org/hono/docs/images/twitter_image.png">
<meta name="twitter:description" content="A set of micro-services for connecting millions of devices.">
<meta property="og:title" content="Command &amp; Control :: Eclipse Hono&amp;trade;" />
<meta property="og:type" content="website" />
<meta property="og:url" content="https://www.eclipse.org/hono/docs/concepts/command-and-control//" />
<meta property="og:image" content="https://www.eclipse.org/hono/docs/images/twitter_image.png" />
</head>
<body class="" data-url="/hono/docs/concepts/command-and-control/">
<nav id="sidebar" class="">
<div id="header-wrapper">
<div id="header">
<a href="https://www.eclipse.org/hono">
<img src="/hono/docs/images/HONO-Logo_Bild-Wort_quer-w-310x120px.svg" alt="Hono logo" class="logo-img">
</a>
</div>
<div class="searchbox">
<label for="search-by"><i class="fas fa-search"></i></label>
<input data-search-input id="search-by" type="search" placeholder="Search...">
<span data-search-clear=""><i class="fas fa-times"></i></span>
</div>
<script type="text/javascript" src="/hono/docs/js/lunr.min.js?1569029010"></script>
<script type="text/javascript" src="/hono/docs/js/auto-complete.js?1569029010"></script>
<script type="text/javascript">
var baseurl = "https:\/\/www.eclipse.org\/hono\/docs\/";
</script>
<script type="text/javascript" src="/hono/docs/js/search.js?1569029010"></script>
</div>
<div class="highlightable">
<ul class="topics">
<li data-nav-id="/hono/docs/concepts/" title="Concepts" class="dd-item
parent
">
<a href="/hono/docs/concepts/">
<i class="far fa-lightbulb"></i> Concepts
</a>
<ul>
<li data-nav-id="/hono/docs/concepts/device-identity/" title="Device Identity" class="dd-item ">
<a href="/hono/docs/concepts/device-identity/">
Device Identity
</a>
</li>
<li data-nav-id="/hono/docs/concepts/tenancy/" title="Multi-Tenancy" class="dd-item ">
<a href="/hono/docs/concepts/tenancy/">
Multi-Tenancy
</a>
</li>
<li data-nav-id="/hono/docs/concepts/device-notifications/" title="Device Notifications" class="dd-item ">
<a href="/hono/docs/concepts/device-notifications/">
Device Notifications
</a>
</li>
<li data-nav-id="/hono/docs/concepts/command-and-control/" title="Command &amp; Control" class="dd-item active">
<a href="/hono/docs/concepts/command-and-control/">
Command &amp; Control
</a>
</li>
<li data-nav-id="/hono/docs/concepts/resource-limits/" title="Resource limits" class="dd-item ">
<a href="/hono/docs/concepts/resource-limits/">
Resource limits
</a>
</li>
<li data-nav-id="/hono/docs/concepts/connection-events/" title="Connection Events" class="dd-item ">
<a href="/hono/docs/concepts/connection-events/">
Connection Events
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/user-guide/" title="User Guide" class="dd-item
">
<a href="/hono/docs/user-guide/">
<i class="fas fa-book-reader"></i> User Guide
</a>
<ul>
<li data-nav-id="/hono/docs/user-guide/device-registry/" title="Device Registry" class="dd-item ">
<a href="/hono/docs/user-guide/device-registry/">
Device Registry
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/http-adapter/" title="HTTP Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/http-adapter/">
HTTP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/mqtt-adapter/" title="MQTT Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/mqtt-adapter/">
MQTT Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/amqp-adapter/" title="AMQP Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/amqp-adapter/">
AMQP Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/kura-adapter/" title="Kura Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/kura-adapter/">
Kura Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/sigfox-adapter/" title="Sigfox Adapter" class="dd-item ">
<a href="/hono/docs/user-guide/sigfox-adapter/">
Sigfox Adapter
</a>
</li>
<li data-nav-id="/hono/docs/user-guide/jmeter_load_tests/" title="Load Tests with JMeter" class="dd-item ">
<a href="/hono/docs/user-guide/jmeter_load_tests/">
Load Tests with JMeter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/admin-guide/" title="Admin Guide" class="dd-item
">
<a href="/hono/docs/admin-guide/">
<i class="fas fa-sliders-h"></i> Admin Guide
</a>
<ul>
<li data-nav-id="/hono/docs/admin-guide/common-config/" title="Common Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/common-config/">
Common Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/auth-server-config/" title="Auth Server Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/auth-server-config/">
Auth Server Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/device-registry-config/" title="Device Registry Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/device-registry-config/">
Device Registry Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/device-connection-config/" title="Configuring the Device Connection Service" class="dd-item ">
<a href="/hono/docs/admin-guide/device-connection-config/">
Device Connection Service Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/http-adapter-config/" title="HTTP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/http-adapter-config/">
HTTP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/amqp-adapter-config/" title="AMQP Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/amqp-adapter-config/">
AMQP Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/mqtt-adapter-config/" title="MQTT Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/mqtt-adapter-config/">
MQTT Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/kura-adapter-config/" title="Kura Adapter Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/kura-adapter-config/">
Kura Adapter Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/hono-client-configuration/" title="Hono Client Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/hono-client-configuration/">
Hono Client Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/amqp-network-config/" title="AMQP 1.0 Messaging Network Configuration" class="dd-item ">
<a href="/hono/docs/admin-guide/amqp-network-config/">
AMQP 1.0 Messaging Network Configuration
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/secure_communication/" title="Secure Communication" class="dd-item ">
<a href="/hono/docs/admin-guide/secure_communication/">
Secure Communication
</a>
</li>
<li data-nav-id="/hono/docs/admin-guide/monitoring-tracing-config/" title="Monitoring &amp; Tracing" class="dd-item ">
<a href="/hono/docs/admin-guide/monitoring-tracing-config/">
Monitoring &amp; Tracing
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/dev-guide/" title="Developer Guide" class="dd-item
">
<a href="/hono/docs/dev-guide/">
<i class="fas fa-tools"></i> Developer Guide
</a>
<ul>
<li data-nav-id="/hono/docs/dev-guide/building_hono/" title="Building from Source" class="dd-item ">
<a href="/hono/docs/dev-guide/building_hono/">
Building from Source
</a>
</li>
<li data-nav-id="/hono/docs/dev-guide/java_client_consumer/" title="Consuming Messages from Java" class="dd-item ">
<a href="/hono/docs/dev-guide/java_client_consumer/">
Consuming Messages from Java
</a>
</li>
<li data-nav-id="/hono/docs/dev-guide/custom_http_adapter/" title="Implement a Custom Hono HTTP Protocol Adapter" class="dd-item ">
<a href="/hono/docs/dev-guide/custom_http_adapter/">
Implement a Custom Hono HTTP Protocol Adapter
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/api/" title="API" class="dd-item
">
<a href="/hono/docs/api/">
&nbsp;<i class='fas fa-plug'></i>&nbsp;API
</a>
<ul>
<li data-nav-id="/hono/docs/api/telemetry/" title="Telemetry API Specification" class="dd-item ">
<a href="/hono/docs/api/telemetry/">
Telemetry API
</a>
</li>
<li data-nav-id="/hono/docs/api/event/" title="Event API Specification" class="dd-item ">
<a href="/hono/docs/api/event/">
Event API
</a>
</li>
<li data-nav-id="/hono/docs/api/command-and-control/" title="Command &amp; Control API Specification" class="dd-item ">
<a href="/hono/docs/api/command-and-control/">
Command &amp; Control API
</a>
</li>
<li data-nav-id="/hono/docs/api/tenant/" title="Tenant API Specification" class="dd-item ">
<a href="/hono/docs/api/tenant/">
Tenant API
</a>
</li>
<li data-nav-id="/hono/docs/api/device-connection/" title="Device Connection API Specification" class="dd-item ">
<a href="/hono/docs/api/device-connection/">
Device Connection API
</a>
</li>
<li data-nav-id="/hono/docs/api/device-registration/" title="Device Registration API Specification" class="dd-item ">
<a href="/hono/docs/api/device-registration/">
Device Registration API
</a>
</li>
<li data-nav-id="/hono/docs/api/credentials/" title="Credentials API Specification" class="dd-item ">
<a href="/hono/docs/api/credentials/">
Credentials API
</a>
</li>
<li data-nav-id="/hono/docs/api/authentication/" title="Authentication API Specification" class="dd-item ">
<a href="/hono/docs/api/authentication/">
Authentication API
</a>
</li>
<li data-nav-id="/hono/docs/api/management/" title="Device Registry Management API Specification" class="dd-item ">
<a href="/hono/docs/api/management/">
Device Registry Management API
</a>
</li>
<li data-nav-id="/hono/docs/api/metrics/" title="Metrics" class="dd-item ">
<a href="/hono/docs/api/metrics/">
Metrics
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/deployment/" title="Deployment" class="dd-item
">
<a href="/hono/docs/deployment/">
<i class="fas fa-shipping-fast"></i> Deployment
</a>
<ul>
<li data-nav-id="/hono/docs/deployment/helm-based-deployment/" title="Helm based Deployment" class="dd-item ">
<a href="/hono/docs/deployment/helm-based-deployment/">
Helm based Deployment
</a>
</li>
<li data-nav-id="/hono/docs/deployment/openshift/" title="OpenShift / OKD" class="dd-item ">
<a href="/hono/docs/deployment/openshift/">
OpenShift / OKD
</a>
</li>
<li data-nav-id="/hono/docs/deployment/create-kubernetes-cluster/" title="Setting up a Kubernetes Cluster" class="dd-item ">
<a href="/hono/docs/deployment/create-kubernetes-cluster/">
Setting up a Kubernetes Cluster
</a>
</li>
<li data-nav-id="/hono/docs/deployment/resource-limitation/" title="Limiting Resource Usage" class="dd-item ">
<a href="/hono/docs/deployment/resource-limitation/">
Limiting Resource Usage
</a>
</li>
</ul>
</li>
<li data-nav-id="/hono/docs/architecture/" title="Architecture" class="dd-item
">
<a href="/hono/docs/architecture/">
<i class="fas fa-landmark"></i> Architecture
</a>
<ul>
<li data-nav-id="/hono/docs/architecture/component-view/" title="Component View" class="dd-item ">
<a href="/hono/docs/architecture/component-view/">
Component View
</a>
</li>
<li data-nav-id="/hono/docs/architecture/auth/" title="Authentication/Authorization" class="dd-item ">
<a href="/hono/docs/architecture/auth/">
Authentication/Authorization
</a>
</li>
</ul>
</li>
</ul>
<section id="shortcuts">
<h3></h3>
<ul>
<li>
<a class="padding" href="https://www.eclipse.org/hono" title="Hono&#39;s Homepage"><i class='fas fa-home'></i> Hono Home</a>
</li>
<li>
<a class="padding" href="https://www.eclipse.org/hono/getting-started" title=""><i class='fas fa-plane-departure'></i> Getting Started</a>
</li>
</ul>
</section>
<section id="prefooter">
<hr/>
<ul>
<li>
<div id="select-box-wrapper">
<div id="select-box">
<a class="padding">
Version:&nbsp;
<div class="select-style">
<select id="select-language" onchange="location = this.value;">
<option id="stable" value="/hono/docs/concepts/command-and-control/" selected>stable (1.0-M7)</option>
<option id="dev" value="/hono/docs/dev/concepts/command-and-control/">dev</option>
</select>
<svg version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="255px" height="255px" viewBox="0 0 255 255" style="enable-background:new 0 0 255 255;" xml:space="preserve">
<g>
<g id="arrow-drop-down">
<polygon points="0,63.75 127.5,191.25 255,63.75 " />
</g>
</g>
</svg>
</div>
</a>
</div>
</div>
</li>
</ul>
</section>
<section id="footer">
<p>&copy; 2019 <a href="https://www.eclipse.org/hono">The Eclipse Hono Project</a></p>
<p>
Documentation built with
<a href="https://www.gohugo.io" target="_blank">Hugo</a>
using the
<a href="https://github.com/matcornic/hugo-theme-learn" target="_blank">Learn</a> theme.
</p>
<div class="eclipse-logo">
<a href="https://www.eclipse.org" target="_blank">
<img src="https://www.eclipse.org/hono/docs/images/eclipse_foundation_logo.svg"/>
</a>
</div>
</section>
</div>
</nav>
<section id="body">
<div id="overlay"></div>
<div class="padding highlightable">
<div>
<div id="top-bar">
<div id="top-github-link">
<a class="github-link" title='Edit this page' href="https://github.com/eclipse/hono/edit/master/site/documentation/content/concepts/command-and-control.md" target="blank">
<i class="fas fa-code-branch"></i>
<span id="top-github-link-text">Edit this page</span>
</a>
</div>
<div id="breadcrumbs" itemscope="" itemtype="http://data-vocabulary.org/Breadcrumb">
<span id="sidebar-toggle-span">
<a href="#" id="sidebar-toggle" data-sidebar-toggle="">
<i class="fas fa-bars"></i>
</a>
</span>
<span id="toc-menu"><i class="fas fa-list-alt"></i></span>
<span class="links">
<a href='/hono/docs/'>Documentation</a> > <a href='/hono/docs/concepts/'>Concepts</a> > Command & Control
</span>
</div>
<div class="progress">
<div class="wrapper">
<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="#command-control-over-http-adapter">Command &amp; Control over HTTP Adapter</a></li>
<li><a href="#command-control-over-mqtt-adapter">Command &amp; Control over MQTT Adapter</a></li>
<li><a href="#command-control-over-amqp-adapter">Command &amp; Control over AMQP Adapter</a></li>
</ul></li>
</ul>
</nav>
</div>
</div>
</div>
</div>
<div id="body-inner">
<h1>Command &amp; Control</h1>
<p><em>Business applications</em> can send commands to devices following the <a href="/hono/docs/api/command-and-control/">Command &amp; Control API</a>. This concept page describes how this API is used by applications to send commands to devices that connected to one of Hono&rsquo;s protocol adapters.</p>
<p>Commands can be sent following a <em>request/response</em> or a <em>one-way</em> pattern. For <em>Request/Response</em> commands, there is always a response expected from the device.</p>
<h2 id="command-control-over-http-adapter">Command &amp; Control over HTTP Adapter</h2>
<p>The following sequence diagrams give an overview of a device connecting via HTTP, which gets a command from the business application in the response to a downstream message - being an arbitrary event in this example. The application and the adapter connect to the AMQP Network, which forwards the transfer - for clarity this is not shown in the diagram.</p>
<p><strong>(Request/Response) command over HTTP:</strong></p>
<figure>
<img src="../command_control_concept_http.svg"/> <figcaption>
<h4>Command &amp; Control over HTTP Adapter</h4>
</figcaption>
</figure>
<p><strong>One-way command over HTTP:</strong></p>
<figure>
<img src="../command_control_concept_one_way_http.svg"/> <figcaption>
<h4>One-way Command &amp; Control over HTTP Adapter</h4>
</figcaption>
</figure>
<p>With the <em>hono-ttd</em> request parameter in (1) the device indicates it will stay connected for max. 30 seconds. In the shown example this means that it can handle the response to the HTTP request for up to 30 seconds before considering the request being expired.</p>
<p>Internally the application is notified that there is a time interval of 30 seconds to send a command (see <a href="/hono/docs/concepts/device-notifications/">Device notifications</a> for details). This notification will be consumed by the application (2) and it now tries to send a command (3) to the device at the given address <code>command/TENANT/4711</code>.
If the device is not connected or the time interval is expired already, there is no such link open and the application would get no credits so send the command.</p>
<p>The HTTP Adapter gets the command and writes it in the response of the devices <code>send event</code> (4), if the request was successful (status 2xx). The HTTP Adapter sets the following response headers and optionally a payload.</p>
<table>
<thead>
<tr>
<th align="left">Response Header</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>hono-cmd</em></td>
<td align="left">The name of the command to execute. Any input data required will be contained in the response body.</td>
</tr>
<tr>
<td align="left"><em>hono-cmd-req-id</em></td>
<td align="left">Only set for <strong>Request/Response commands</strong> : The unique identifier of the command. This identifier is used to correlate the device&rsquo;s response to the command with the request.</td>
</tr>
</tbody>
</table>
<p>The <em>hono-cmd</em> is the command that should be executed by the device. Typically this command needs to be known by the device and the payload may contain additional details of the command.</p>
<p><strong>For Request/Response commands</strong>:</p>
<p>The <em>hono-cmd-req-id</em> response header is needed for the command response to correlate it. It has to be sent back from the device to the adapter in a following operation (5).</p>
<p>The device needs to respond to the command (5), to inform the business application about the outcome of executing the command. For this purpose
specific URIs are defined in <a href="/hono/docs/user-guide/http-adapter/#sending-a-response-to-a-previously-received-command">HTTP Adapter</a>.</p>
<p>The URI contains the <em>hono-cmd-req-id</em> and a status code indicating the outcome of executing the command.</p>
<p>The HTTP Adapter will send the payload of the response back to the Business Application (6) by using the receiver link
that was opened by the application. If the response reached the application, the response request will be replied with
<code>202 Accepted</code>.</p>
<h2 id="command-control-over-mqtt-adapter">Command &amp; Control over MQTT Adapter</h2>
<p>When the device is connected to the MQTT Adapter it receives <em>Request/Response</em> commands on the topic:</p>
<ul>
<li><code>command/[${tenant}]/[${device-id}]/req/${req-id}/${command}</code></li>
</ul>
<p>and <em>one-way</em> commands on the topic:</p>
<ul>
<li><code>command/[${tenant}]/[${device-id}]/req//${command}</code></li>
</ul>
<p>Authenticated devices typically subscribe to</p>
<ul>
<li><code>command/+/+/req/#</code></li>
</ul>
<p>while unauthenticated devices have to fully specify their <code>${tenant}</code> and <code>${device-id}</code> during the subscription.</p>
<p>The response of the command will be sent by the device to</p>
<ul>
<li><code>command/[${tenant}]/[${device-id}]/res/${req-id}/${status}</code></li>
</ul>
<p>If the device is authenticated, the <code>${tenant}</code> and <code>${device-id}</code> are left empty (resulting in 3 subsequent <code>/</code>s).</p>
<p>The following diagrams show the message flow for commands over the MQTT adapter:</p>
<p><strong>Request/Response commands</strong> :</p>
<figure>
<img src="../command_control_concept_mqtt.svg"/> <figcaption>
<h4>Request/Response Command over MQTT Adapter</h4>
</figcaption>
</figure>
<p><strong>one-way commands</strong> :</p>
<figure>
<img src="../command_control_concept_one_way_mqtt.svg"/> <figcaption>
<h4>One-way Command over MQTT Adapter</h4>
</figcaption>
</figure>
<h2 id="command-control-over-amqp-adapter">Command &amp; Control over AMQP Adapter</h2>
<p>When a device connected to the AMQP adapter wants to receive commands from the adapter, it opens a receiver link specifying the following source address:</p>
<ul>
<li><code>command</code> for authenticated devices</li>
<li><code>command/${tenant}/${device-id}</code> for unauthenticated devices</li>
</ul>
<p>Once the receiver link is opened, the AMQP adapter sends command messages to devices through the link. The <em>subject</em> property of the request message contains the actual command to be executed on the device.</p>
<p>If the command request is a <em>one-way command</em>, then the device need not publish a command response message. However, if the application expects a response, then devices should publish a response back to the application. If an anonymous sender link is already opened by the device (e.g for publishing telemetry or events), then the device can reuse that link to publish the command response message. Otherwise, the device should publish the response by opening an anonymous sender link. The device should set the message address, status and correlation-id properties of the response accordingly. Consult the table below for a list of properties that a device must set on a command response message.</p>
<p><strong>Command Request Message Properties</strong></p>
<p>The following properties are set by the AMQP adapter on a command message sent to devices.</p>
<table>
<thead>
<tr>
<th align="left">Name</th>
<th align="center">Mandatory</th>
<th align="left">Location</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>subject</em></td>
<td align="center">yes</td>
<td align="left"><em>properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">Contains the name of the command to be executed on a device.</td>
</tr>
<tr>
<td align="left"><em>reply-to</em></td>
<td align="center">yes</td>
<td align="left"><em>properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">Contains the address to which the command response should be published to. This value is empty for one-way commands.</td>
</tr>
<tr>
<td align="left"><em>correlation-id</em></td>
<td align="center">yes</td>
<td align="left"><em>properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">Contains the identifier used to correlate the response with the command request. If the command sent by the application contains a correlation-id, then that value is used as the correlation-id of the command request sent to the device. Otherwise, the value of the message-id property is used instead.</td>
</tr>
</tbody>
</table>
<p><strong>Command Response Message Properties</strong></p>
<p>If the application expects a response (i.e the <em>reply-to</em> property is set), then the device should set the following properties on a command response message.</p>
<table>
<thead>
<tr>
<th align="left">Name</th>
<th align="center">Mandatory</th>
<th align="left">Location</th>
<th align="left">Type</th>
<th align="left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td align="left"><em>to</em></td>
<td align="center">yes</td>
<td align="left"><em>properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">MUST contain the address to which the command response should be published to, which is the value of the reply-to property of the command request message.</td>
</tr>
<tr>
<td align="left"><em>correlation-id</em></td>
<td align="center">yes</td>
<td align="left"><em>properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">MUST contain the identifier used to correlate the response with the original request, which is the value of the correlation-id of the original request.</td>
</tr>
<tr>
<td align="left"><em>status</em></td>
<td align="center">yes</td>
<td align="left"><em>application-properties</em></td>
<td align="left"><em>string</em></td>
<td align="left">The status code indicating the outcome of processing the command by the device. MUST be set by the device after executing the command.</td>
</tr>
</tbody>
</table>
<figure>
<img src="../command_control_concept_amqp.svg"/> <figcaption>
<h4>Command &amp; Control over AMQP Adapter</h4>
</figcaption>
</figure>
<footer class=" footline" >
</footer>
</div>
</div>
<div id="navigation">
</div>
</section>
<div style="left: -1000px; overflow: scroll; position: absolute; top: -1000px; border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;">
<div style="border: none; box-sizing: content-box; height: 200px; margin: 0px; padding: 0px; width: 200px;"></div>
</div>
<script src="/hono/docs/js/clipboard.min.js?1569029010"></script>
<script src="/hono/docs/js/perfect-scrollbar.min.js?1569029010"></script>
<script src="/hono/docs/js/perfect-scrollbar.jquery.min.js?1569029010"></script>
<script src="/hono/docs/js/jquery.sticky.js?1569029010"></script>
<script src="/hono/docs/js/featherlight.min.js?1569029010"></script>
<script src="/hono/docs/js/html5shiv-printshiv.min.js?1569029010"></script>
<script src="/hono/docs/js/highlight.pack.js?1569029010"></script>
<script>hljs.initHighlightingOnLoad();</script>
<script src="/hono/docs/js/modernizr.custom.71422.js?1569029010"></script>
<script src="/hono/docs/js/learn.js?1569029010"></script>
<script src="/hono/docs/js/hugo-learn.js?1569029010"></script>
<link href="/hono/docs/mermaid/mermaid.css?1569029010" type="text/css" rel="stylesheet" />
<script src="/hono/docs/mermaid/mermaid.js?1569029010"></script>
<script>
mermaid.initialize({ startOnLoad: true });
</script>
<script>
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-5WLCZXC');
</script>
<script src="https://www.eclipse.org/eclipse.org-common/themes/solstice/public/javascript/vendor/cookieconsent/default.min.js"></script>
</body>
</html>