one thing to bare in mind with durable
subscriptions which occur when clean session is set to false:- once a subscription
has been made it survives restarts of the client. The server persists
durable subscriptions and ensures that any messages matching the subscription
are queued for the client when it is not connected and delivered the next
time it connects. With MQTT there is no need for the client to resubscribe
when it reconnects as the MQTT server already has it safely stored it.
If the app does subscribe and a matching subscription is in place
it will only keep one active.
In most solutions the application encodes
the topic or topics that it subscribes to. In many cases an application
will only subscribe to a single topic.
As an aside many MQTT servers provide
a mechanism to query what subscriptions are active
discussions for paho project <paho-dev@xxxxxxxxxxx>,
Question on MqttClient's subscriptions
none of the existing clients (that I know and regularly use) provide
this functionality, so the java client is no different. This was not a
feature purposefully left off the api - it was simply never considered
Your application is doing the subscribing, so it can very easily keep
a list of the topics it has subscribed to.
Of course you can patch your copy for your needs. If you think it is
generally useful you can supply a patch to the paho bugzilla where it
can be evaluated by the paho committers.
On 20 September 2012 20:35, Sopot Çela <sopotcela@xxxxxxxxx> wrote:
> Hi Nick,
> Is this by design? If so why? If not, can I patch it?
> On Thu, Sep 20, 2012 at 9:33 PM, Nicholas O'Leary <nick.oleary@xxxxxxxxx>
>> Hi Sopot,
>> as you have seen, there is no public API in the client to retrieve
>> that information.
>> So, you either need to maintain that list in your application,
>> could modify the paho client to expose the list.
>> On 20 September 2012 20:23, Sopot Çela <sopotcela@xxxxxxxxx>
>> > Hi Paho devs,
>> > I have posted a question (the first ever) on the Paho forums
>> > http://www.eclipse.org/forums/index.php/t/379061/
Since the forum is
>> > there I
>> > would appreciate it if any of the competent members of the
>> > community
>> > would monitor it since it is a delicate time to not answer
>> > questions.
>> > However I am pasting the question here in case you all disagree.
>> > I have a MqttClient. How can I have a list of the topics
>> > subscribed
>> > to? I see they are stored in a Hashtable but no public API
to get them.
>> > Best,
>> > Sopot
>> > _______________________________________________
>> > paho-dev mailing list
>> > paho-dev@xxxxxxxxxxx
>> > http://dev.eclipse.org/mailman/listinfo/paho-dev
>> paho-dev mailing list
> paho-dev mailing list
paho-dev mailing list
Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6