blob: 805c895723fd583a8184c5043540f3cf7f9418bd [file] [log] [blame]
<!DOCTYPE html>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="">
<meta name="keywords" content="blog, ">
<title> Weak acknowledgments to decouple signal publishers and subscribers </title>
<link rel="stylesheet" href="css/syntax.css">
<link rel="stylesheet" type="text/css" href="//" crossorigin="anonymous">
<link rel="stylesheet" href="css/modern-business.css">
<link rel="stylesheet" href="//" crossorigin="anonymous">
<link rel="stylesheet" href="css/customstyles.css">
<link rel="stylesheet" href="css/boxshadowproperties.css">
<link rel="stylesheet" href="css/theme-ditto.css">
<link rel="stylesheet" href=",700|Source+Code+Pro:300,600|Titillium+Web:400,600,700">
<script src="//" crossorigin="anonymous"></script>
<script src="//" crossorigin="anonymous"></script>
<script src="//" crossorigin="anonymous"></script>
<script src="js/toc.js"></script>
<script src="js/customscripts.js"></script>
<script type="application/ld+json">
"@context": "",
"@type": "Organization",
"url": "",
"logo": ""
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16">
<link rel="icon" type="image/png" href="images/favicon-32x32.png" sizes="32x32">
<link rel="icon" type="image/png" href="images/favicon-96x96.png" sizes="96x96">
<link rel="alternate" type="application/rss+xml" title="Eclipse Ditto Blog" href="">
<!-- Eclipse Foundation cookie consent: -->
<link rel="stylesheet" type="text/css" href="//" />
<script src="//"></script>
$(document).ready(function() {
$("#tg-sb-link").click(function() {
new Date().getTime(),event:'gtm.js'});
var f=d.getElementsByTagName(s)[0],
<!-- Navigation -->
<nav class="navbar navbar-inverse navbar-fixed-top">
<div class="container topnavlinks">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<a class="navbar-ditto-home" href="index.html">&nbsp;<img src="images/ditto_allwhite_symbolonly.svg" class="ditto-navbar-symbol" alt="Home"> <img src="images/ditto_allwhite_textonly.svg" class="ditto-navbar-symbol-text" alt="Ditto"></a>
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav navbar-right">
<!-- toggle sidebar button -->
<!--<li><a id="tg-sb-link" href="#"><i id="tg-sb-icon" class="fa fa-toggle-on"></i> Nav</a></li>-->
<!-- entries without drop-downs appear here -->
<li><a href="blog.html">Blog</a></li>
<li><a href="intro-overview.html">Documentation</a></li>
<li><a href="http-api-doc.html">HTTP API</a></li>
<li><a href="sandbox.html">Sandbox</a></li>
<li><a href="" target="_blank">GitHub</a></li>
<li><a href="" target="_blank">GitHub examples</a></li>
<!-- entries with drop-downs appear here -->
<!-- conditional logic to control which topnav appears for the audience defined in the configuration file.-->
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Links<b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="" target="_blank">Eclipse Ditto Project</a></li>
<li><a href="" target="_blank">Forum</a></li>
<li><a href="" target="_blank">Jenkins</a></li>
<li><a href="" target="_blank">Mailing list archives</a></li>
<li><a href="" target="_blank"> chat</a></li>
<!--comment out this block if you want to hide search-->
<!--start search-->
<div id="search-demo-container">
<input type="text" id="search-input" placeholder="search...">
<ul id="results-container"></ul>
<script src="//" type="text/javascript"></script>
<script type="text/javascript">
searchInput: document.getElementById('search-input'),
resultsContainer: document.getElementById('results-container'),
dataSource: 'search.json',
searchResultTemplate: '<li><a href="{url}" title="Weak acknowledgments to decouple signal publishers and subscribers">{title}</a></li>',
noResultsText: 'No results found.',
limit: 10,
fuzzy: true,
<!--end search-->
<!-- /.container -->
<!-- Page Content -->
<div class="container">
<div id="main">
<!-- Content Row -->
<div class="row">
<!-- Content Column -->
<div class="col-md-12" id="tg-sb-content">
<!-- Look the author details up from the site config. -->
<!-- Output author details if some exist. -->
<!-- Output author details if some exist. -->
<!--&lt;!&ndash; Mugshot. &ndash;&gt;-->
<!--<img src="" alt="A photo of Yufei Cai" />-->
<!--&lt;!&ndash; Personal Info. &ndash;&gt;-->
<!--Written by <a href="" target="_blank">Yufei Cai</a>-->
<article class="post" itemscope itemtype="">
<header class="post-header">
<h1 class="post-title" itemprop="name headline">Weak acknowledgments to decouple signal publishers and subscribers</h1>
<p class="post-meta">Published by <img src="" alt="A photo of Yufei Cai" style="width:50px;border-radius:50%;display:inline-block;margin-right:5px;" /><span itemprop="author" itemscope itemtype=""><span itemprop="name"><a href="" target="_blank">Yufei Cai</a> </span></span> on <time datetime="2020-11-16T00:00:00+00:00" itemprop="datePublished">Nov 16, 2020</time> - Tags:
<a href="tag_blog.html">blog</a>
<div class="post-content" itemprop="articleBody">
<!-- this handles the automatic toc. use ## for subheads to auto-generate the on-page minitoc. if you use html tags, you must supply an ID for the heading element in order for it to appear in the minitoc. -->
$( document ).ready(function() {
// Handler for .ready() called.
$('#toc').toc({ minimumHeaders: 0, listType: 'ul', showSpeed: 0, headers: 'h2,h3,h4' });
/* this offset helps account for the space taken up by the floating toolbar. */
$('#toc').on('click', 'a', function() {
var target = $(this.getAttribute('href'))
, scroll_target = target.offset().top
$(window).scrollTop(scroll_target - 10);
return false
<div id="toc"></div>
<h2 id="motivation">Motivation</h2>
<p><a href="2020-08-31-release-announcement-120.html">Ditto 1.2.0</a> introduced at-least-once delivery via
<a href="basic-acknowledgements.html">acknowledgement requests</a>.<br />
It increased coupling between the publisher and the subscriber of signals in that the subscriber is no longer at the
liberty to filter for signals it is interested in. Instead, the subscriber must consume all signals in order to
fulfill acknowledgement requests and prevent endless redelivery.</p>
<p>To combat the problem,
<a href="2020-10-28-release-announcement-140.html">Ditto 1.4.0</a> made acknowledgement labels unique and introduced the requirement
to manage <a href="basic-acknowledgements.html#issuing-acknowledgements"><em>declared acknowledgements</em></a>, identifying of each
subscriber.<br />
It is now possible for Ditto to issue
<a href="basic-acknowledgements.html#weak-acknowledgements-wacks"><em>weak acknowledgements</em></a> on behalf of the subscriber
whenever it decides to not consume a signal. That allows subscribers to configure RQL and namespace filters freely
without causing any futile redelivery.</p>
<div class="alert alert-info" role="alert"><i class="fa fa-info-circle"></i> <b>Note:</b> Weak acknowledgements are available since Ditto 1.5.0.</div>
<h2 id="what-it-is">What it is</h2>
<p>A <a href="basic-acknowledgements.html#weak-acknowledgements-wacks"><em>weak acknowledgement</em></a> is issued by Ditto for any
<a href="basic-acknowledgements.html#requesting-acks">acknowledgement request</a> that will not be fulfilled now or ever without
configuration change.<br />
A weak acknowledgement is identified by the header <code class="highlighter-rouge">ditto-weak-ack: true</code>.</p>
<p>The status code of weak acknowledgements is <code class="highlighter-rouge">200 OK</code>; it signifies that any redelivery is not to be made on their
<p>A weak acknowledgement may look like this in Ditto protocol:</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">"topic"</span><span class="p">:</span><span class="w"> </span><span class="s2">"com.acme/xdk_53/things/twin/acks/my-mqtt-connection:my-mqtt-topic"</span><span class="p">,</span><span class="w">
</span><span class="s2">"headers"</span><span class="p">:</span><span class="w"> </span><span class="p">{</span><span class="w">
</span><span class="s2">"ditto-weak-ack"</span><span class="p">:</span><span class="w"> </span><span class="kc">true</span><span class="w">
</span><span class="p">},</span><span class="w">
</span><span class="s2">"path"</span><span class="p">:</span><span class="w"> </span><span class="s2">"/"</span><span class="p">,</span><span class="w">
</span><span class="s2">"value"</span><span class="p">:</span><span class="w"> </span><span class="s2">"Acknowledgement was issued automatically, because the subscriber is not authorized to receive the signal."</span><span class="p">,</span><span class="w">
</span><span class="s2">"status"</span><span class="p">:</span><span class="w"> </span><span class="mi">200</span><span class="w">
</span><span class="p">}</span><span class="w">
<h2 id="how-it-works">How it works</h2>
<p>Since Ditto 1.4.0, subscribers of <em>twin events</em> or <em>live signals</em> are required to declare unique acknowledgement labels
they are allowed to send. The labels of acknowledgement requests are then identifying the intended subscribers.<br />
If the intended subscriber exists but does not receive the signal for non-transient reasons, Ditto issues
a weak acknowledgement for that subscriber.<br />
Such reasons may be:</p>
<li>The intended subscriber <strong>is not authorized</strong> to receive the signal by policy;</li>
<li>The intended subscriber did not subscribe for the signal type (<em>twin event, live command, live event or live message</em>);</li>
<li>The intended subscriber filtered the signal out by its <a href="basic-changenotifications.html#filtering">namespace or RQL filter</a>;</li>
<li>The intended subscriber dropped the signal because its <a href="connectivity-mapping.html">payload mapper</a> produced nothing.</li>
<h2 id="limitation">Limitation</h2>
<p>The distributed nature of cluster pub/sub means that weak acknowledgements are not always issued correctly.<br />
They are only <em>eventually correct</em> in the sense that some time after a change to the publisher-subscriber pair,
the issued weak acknowledgements will reflect the change.<br />
Such changes include:</p>
<li>Opening and closing of Websocket or other connections acting as the subscriber;</li>
<li>Subscribing and unsubscribing for different signal types via Websocket;</li>
<li>Modification of connections via the <a href="connectivity-manage-connections.html">connectivity API</a>;</li>
<li>Migration of a connection from one Ditto cluster member to another due to load balancing.</li>
<h2 id="feedback">Feedback?</h2>
<p>Please <a href="feedback.html">get in touch</a> if you have feedback or questions towards this new concept of weak
<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>
<hr class="shaded"/>
<div class="row">
<div class="col-lg-12 footer">
<div class="logo">
<a href=""><img src="images/eclipse_foundation_logo.svg" alt="Eclipse logo"/></a>
<p class="notice">
&copy;2020 Eclipse Ditto.
Site last generated: Dec 9, 2020 <br />
<div class="quickLinks">
<a href="" target="_blank">
&gt; Privacy Policy
<a href="" target="_blank">
&gt; Terms of Use
<a href="" target="_blank">
&gt; Copyright Agent
<a href="" target="_blank">
&gt; Legal
<a href="" target="_blank">
&gt; License
<a href="" target="_blank">
&gt; Report a Vulnerability
<!-- /.row -->
<!-- /.container -->
<!-- /#main -->