Thanks for your reply, it has pointed me in the right direction.
The case of PUBACK with code 0x83 is answered in the section
4.8.2 of the spec: "If a Client responds with a PUBACK or
PUBREC containing a Reason Code of 0x80 or greater to a PUBLISH
packet from the Server, the Server MUST discard the Application
Message and not attempt to send it to any other Subscriber".
In the disconnection case, the messages should be resent: "If the Client's Session terminates before the Client reconnects, the Server SHOULD send the Application Message to another Client that is subscribed to the same Shared Subscription".
I will explain a bit what I am trying to do. I am trying to port
a distributed task queue to VerneMQ. So "tasks" are published to a
shared topic, and the broker balances the load among a pool of
equipotent "workers" which consume and process these tasks.
When a "task" is published to the topic (with QoS 1) it should be
sent as quick as possible to a (preferably idle) "worker" client
subscribed to the topic (with QoS 1). After the task is processed,
the "task" message is acknowledged signaling the broker to send
more "tasks" messages.
If a worker crashes, any "task" assigned to it (in flight
messages) should be sent to another "worker" client.
So I am using:
- "Session Expiry Interval" = 0 (to make the session ends when
the network connection is closed)
- "Clean Start" = 1 (start a new session)
- "Receive Maximum" = 1 (so no messages are sent to busy
clients)
But it doesn't work: messages are not being retransmitted if the
network connection is closed. I guess that the in flight messages
already assigned to the expired session are not reassigned to
another client. This may or may not be a bug, based on the
opininon about what "SHOULD" means... I suggest calling
this a "non fully supported feature" and move on :)
Waiting anxiously for VerneMQ 2.0,
José