Repository navigation
fix(binding-mqtt-kafka): compare message expiry interval in seconds - #3137
Merged
jfallows merged 2 commits intoNov 12, 2026
Conversation
This was referenced Nov 12, 2026
jfallows
force-pushed
the
fix/3131-mqtt-kafka-message-expiry-seconds
branch
from
November 12, 2026 20:22
c2a3c02 to
4da6cc3
Compare
Correct the expire.message scripts so a one second interval has clearly passed, and add scripts for a message that waited part of its interval, and for the same cases on a retained replay. Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoVeWBEApS7TUPZ4CA8
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01SiHVoVeWBEApS7TUPZ4CA8
jfallows
force-pushed
the
fix/3131-mqtt-kafka-message-expiry-seconds
branch
from
November 12, 2026 21:02
4da6cc3 to
033c93e
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The MQTT Message Expiry Interval is in seconds, but the subscribe path compared it as milliseconds.
MqttKafkaPublishFactorywrites the interval unchanged into the 4-bytezilla:expiryheader (seconds).MqttKafkaSubscribeFactorythen computedtimestamp(ms) + timeout(seconds) - now(ms)in both the live path and the retained replay path, and forwarded that millisecond count as the interval to the client. A message with an N-second interval was therefore dropped after about N milliseconds, and any message that survived carried a millisecond count in a seconds field.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.
Changes, all in
MqttKafkaSubscribeFactory:timestamp + seconds * 1000, compared against the current time in milliseconds, in the live path and in the retained replay path.zilla:expiryheader stays in seconds, so records already in Kafka topics remain valid. The publish side is unchanged.Spec scripts:
subscribe.expire.messageandsubscribe.expire.message.fragmented(kafka side) were changed because they encoded the unit mix-up: they usedzilla:expiry= 1 against a 1000 ms delta. The delta is now 5000 ms so the 1 second interval has clearly passed. New scripts cover a live message that waited part of its interval (4s interval, waited 1.5s, delivered with 2), a retained replay of the same, and a retained message whose interval has passed (dropped, later live message still delivered).Fixes #3131
Stack (each PR is based on the previous branch):
fix/3129-mqtt-per-connection-limitsdevelopfix/3130-mqtt-kafka-connack-maximum-qosfix/3129-mqtt-per-connection-limitsfix/3131-mqtt-kafka-message-expiry-secondsfix/3130-mqtt-kafka-connack-maximum-qosfix/3132-mqtt-kafka-retained-tombstonefix/3131-mqtt-kafka-message-expiry-secondsfix/3133-mqtt-v4-clean-session-persistencefix/3132-mqtt-kafka-retained-tombstoneTest evidence
Test-first: after the test commit alone (against
develop),MqttKafkaSubscribeProxyITran 58 tests with 2 failing:shouldReceiveMessageWithReducedExpiryIntervalandshouldReceiveRetainedMessageWithReducedExpiryInterval, because the old code forwarded a millisecond count. The two expired-message tests (live and retained) passed on the old code as well and act as regression guards.After the fix, rebased onto the PR 2 branch,
./mvnw clean verify -pl specs/binding-mqtt-kafka.spec,runtime/binding-mqtt-kafka(checkstyle and license checks included) passed:specs/binding-mqtt-kafka.spec: 27 unit tests,MqttIT97,KafkaIT122runtime/binding-mqtt-kafka: 10 unit tests,MqttKafkaSubscribeProxyIT58,MqttKafkaSessionProxyIT30,MqttKafkaPublishProxyIT39Notes
The rebase onto the PR 2 branch had no conflicts. No follow-ups found.
Generated by Claude Code