You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mqtt-kafka: Message Expiry Interval is compared as milliseconds instead of seconds #3131
The MQTT Message Expiry Interval is in seconds. In the publish-to-subscribe path it is carried as raw seconds but compared as milliseconds (line numbers on develop at 1e802cb):
MqttKafkaPublishFactory (lines 500-511) writes the interval, unchanged, as a 4-byte zilla:expiry header.
MqttKafkaSubscribeFactory (live path ~1301-1306, retained path ~2077-2084) computes timestamp + helper.timeout - now() with timestamp and now() in milliseconds and helper.timeout in seconds, and sends (int) expireInterval back as the Message Expiry Interval (~1352-1360).
Effects: a message with an N-second interval is dropped after about N milliseconds, and the interval forwarded to the client is a millisecond count in a seconds field.
The existing spec script subscribe.expire.message uses zilla:expiry = 1 against a millisecond timestamp delta, so it encodes the same confusion.
MQTT 5.0 section 3.3.2.3.3: a message whose interval has passed before onward delivery starts must not be delivered to that subscriber, and the PUBLISH sent to a client carries the received interval minus the time the message waited on the server.
Expected
The zilla:expiry header stays in seconds, so records already in Kafka topics remain valid.
The expiry deadline is timestamp + seconds * 1000, compared against the current time in milliseconds, in the live path and in the retained replay path.
The interval forwarded to the client is the remaining time in whole seconds. A message with no time left is dropped.
Test plan (test-first)
Correct subscribe.expire.message (and the fragmented variant) in specs/binding-mqtt-kafka.spec, since it violates the protocol, and add scripts for:
a message that has waited part of its interval is delivered with the reduced interval in seconds;
a message whose interval has passed is not delivered;
the same for a retained replay.
The first commit contains the failing scripts.
Notes
Found by a clause-by-clause conformance audit, by reading the code. Part of the MQTT conformance work under #512.
Activity