[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: Lifetime of topic alias map
Hi, I have a question about the lifetime of TopicAlias map. According to https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Topic_Alias > Topic Alias mappings exist only within a Network Connection and last only for the lifetime of that Network Connection. It seems that the lifetime of the map is over when the network connection is closed. Consider the following scenario. 1. Client connects to the broker with CleanStart: false SessionExpiryInterval=0xfffffffff(infinity) 2. Client publishes topic1 with TopicAlias: 1, QoS: 1, PacketId: 1 Broker inserts topic1 - ToppicAlias 1 entry to the map. 3. Client publishes empty topic with TopicAlias: 1, QoS: 1, PacketId: 2 Broker finds topic1 from the map using TopicAlias 1 as the key. 4. Client receives PUBACK PacketId: 1. 5. Disconnect between the client and the broker. Broker clears the map here. 6. Client connects to the broker with CleanStart: false SessionExpiryInterval=0xfffffffff(infinity) 7. Client publishes empty topic with TopicAlias: 1, QoS: 1, PacketId: 2 (PUBACK PacketId: 2 is not received so resend step 3 message) 8. Broker can't find the topic corresponding to the TopicAlias: 1 in the map because the map has been cleared at the step 5. What should happen here? Should the broker disconnect the client due to no matching TopicAlias with empty TopicName ? If the client continues to re-connect with the same parameter, the publish packet at the step 3 is never processed by the broker. The client needs to set CleanStart: true to erase re-send publish message. But it avoids message deliverty guarantee. I think that if the lifetime of the map is the same as session lifetime, it is easy to use. At the step 5, broker dossn't clear the map. The lifetime of the map is extended until the session lifetime is over. However, session is defined as follows: https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc473619931 > A stateful interaction between a Client and a Server. Some Sessions last only as long as the Network Connection, others can span multiple consecutive Network Connections between a Client and a Server. It seems ttat Network Connection and session are different concept. I think that TopicAlias mapping should have the same lifetime as the session lifetime. Any ideas? ---- Thanks, Takatoshi
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]