1 Answer
- Newest
- Most votes
- Most comments
0
Let me clarify how message counting works with retained messages in AWS IoT Core when using persistent sessions:
- Initial Persistent Session Creation:
- When a persistent session is first created: 2 messages are counted
- 1 message for delivering retained message to persistent session
- 1 message for delivering from persistent session to client
- Client Reconnection Scenario:
- When client reconnects to an existing persistent session: 1 message is counted
- Only the delivery from persistent session to client is counted
- No new delivery to persistent session is needed since it already has the retained message
The key points are:
- The double counting (2 messages) only happens during initial persistent session creation
- Subsequent reconnections within the persistent session validity period only count as 1 message
- This is because the persistent session maintains the retained message state between reconnections
So in your example:
- First connection: 2 messages counted
- Disconnect and reconnect: 1 additional message counted Total: 3 messages
This behavior helps optimize message counts while still maintaining the reliability guarantees of persistent sessions.
answered a year ago
Relevant content
asked 2 years ago
asked 10 months ago
