INT-3467 MQTT Modify Subscribed Topics at Runtime

JIRA: https://jira.spring.io/browse/INT-3467

Add methods and managed operations to the inbound
channel adapter to allow the subscribed topics to be
changed at runtime, programmatically, or using a
control-bus.
This commit is contained in:
Gary Russell
2014-07-10 16:17:01 -04:00
committed by Artem Bilan
parent dcdaafc075
commit 84e3d4e126
7 changed files with 367 additions and 36 deletions

View File

@@ -99,6 +99,25 @@
containing the failed message and cause.
</callout>
</calloutlist>
<section>
<title>Adding/Removing Topics at Runtime</title>
<para>
Starting with <emphasis>version 4.1</emphasis>, it is possible to programmatically change the topics
to which the adapter is subscribed. Methods <code>addTopic()</code> and <code>removeTopic()</code> are
provided. When adding topics, you can optionally specify the <code>QoS</code> (default: 1). You can
also modify the topics by sending an appropriate message to a <code>&lt;control-bus/&gt;</code> with
an appropriate payload: <code>"myMqttAdapter.addTopic('foo', 1)"</code>.
</para>
<para>
Stopping/starting the adapter has no effect on the topic list (it does <emphasis role="bold">not</emphasis>
revert to the original settings in the configuration). The changes are not retained beyond the
life cycle of the application context; a new application context will revert to the configured settings.
</para>
<para>
Changing the topics while the adapter is stopped (or disconnected from the broker) will take effect
the next time a connection is established.
</para>
</section>
</section>
<section id="mqtt-outbound">

View File

@@ -63,11 +63,15 @@
</para>
<para>
The MQTT message-driven channel adapter now supports specifying the QoS setting for each
subscription. See <xref linkend="mqtt"/> for more information.
subscription. See <xref linkend="mqtt-inbound"/> for more information.
</para>
<para>
The MQTT outbound channel adapter now supports asynchronous sends, avoiding blocking
until delivery is confirmed. See <xref linkend="mqtt"/> for more information.
until delivery is confirmed. See <xref linkend="mqtt-outbound"/> for more information.
</para>
<para>
It is now possible to programmatically subscribe to and unsubscribe from topics at runtime.
See <xref linkend="mqtt-inbound"/> for more information.
</para>
</section>
</section>