The default expiry interval of Apache ActiveMQ Artemis for MQTT5 sessions is 0. It means that the session is cleared soon after the client disconnection if the client doesn't specify an expiry interval. What is the session expiry interval that client1 is specifying?
Domenico On Thu, 6 Mar 2025 at 12:51, Ben Short <b...@benshort.co.uk> wrote: > Hi, > > I'm struggling to configure my Artemis instance to support MQTT > persistent Subscriptions. > > I have two NodeJS MQTT5 clients. > > Client 1 connects and then subscribes to a topic. > Client 2 connects and then publishes messages to the topic every 1000ms. > > Both set the clear option to false and set the QoS to 1 when subscribing > and publishing. > > When using these clients against HiveMQ's public MQTT MQ I see the > following behavior. > > Start Client 2 which connects and starts publishing messages. > Start Client 1 which connects and starts receiving messages. > Disconnect Client 1. > Wait 5 seconds. > Start Client 1 which connects and receives the messages publish while it > was not connected. > > > When I try the same thing with my Artemis instance the messages > published while Client 1 is not connected are lost. > > > The following shows the Artemis logging during the test steps: > > [MQTTSession] MQTT session created: cdb31991-d5aa-447e-8d09-d640e2bca4c0 > [MQTTStateManager] Adding MQTT session state for: client2 > [MQTTStateManager] Adding durable MQTT state record for: client2 > [MQTTStateManager] Serializing 0 subscriptions > [MQTTSession] MQTT session created: a6b9e876-ae42-4cbf-b098-40c00f164245 > [MQTTStateManager] Adding MQTT session state for: client1 > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 0 subscriptions > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 1 subscriptions > [MQTTSessionState] Matching hul/101/in with hul/101/in$: true > [MQTTSessionState] Matching hul/101/in with hul/101/in$: true > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 0 subscriptions > [MQTTStateManager] Removing MQTT session state for: client1 > [MQTTStateManager] Removed 1 durable MQTT state records for: client1 > [MQTTSession] MQTT session created: 68f3bb3c-b243-4d63-bdaa-81af0d3872db > [MQTTStateManager] Adding MQTT session state for: client1 > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 0 subscriptions > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 1 subscriptions > [MQTTSessionState] Matching hul/101/in with hul/101/in$: true > [MQTTSessionState] Matching hul/101/in with hul/101/in$: true > [MQTTStateManager] Adding durable MQTT state record for: client1 > [MQTTStateManager] Serializing 0 subscriptions > [MQTTStateManager] Removing MQTT session state for: client1 > [MQTTStateManager] Removed 1 durable MQTT state records for: client1 > > I have tried with persistence enabled and disabled in the broker.xml > > Any ideas where I'm going wrong? > > Regards > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@activemq.apache.org > For additional commands, e-mail: users-h...@activemq.apache.org > For further information, visit: https://activemq.apache.org/contact > > >