Repository navigation
Enforce store requirement for MQTT server bindings - #1963
Conversation
…y packet queue The QoS2 session "#offsets" choreography introduced in PR #1806 drives its ack state machine off the Kafka offset-commit stream WINDOW frames: onKafkaWindow routes the first WINDOW to onOffsetCommitOpened (seed) and every subsequent WINDOW to onOffsetCommitAck. After the seed commit is acked the session stream is created and offsetCommitSeeded is cleared, so any further flow-control WINDOW falls into the else branch and calls unackedPacketIds.remove() on an empty queue, throwing NoSuchElementException. That exception propagates as an AgentTerminationException and kills the engine worker, taking down every binding on the worker — which is why the mqtt.kafka.proxy and asyncapi.mqtt.kafka.proxy example smoke tests fail to complete the MQTT CONNECT on develop. WINDOW frames are flow-control credit and do not map one-to-one to produce acks, so only pop a packet id when one is actually pending (a real QoS2 offset commit added it via doCommitOffsetComplete); otherwise the WINDOW is just additional credit and is ignored. Verified by running the mqtt.kafka.proxy example end-to-end against real Kafka: the worker no longer crashes and the publish/subscribe round-trip succeeds. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
00f56a4 to
e49a387
Compare
|
Reduced this PR to the single root-cause fix and force-pushed. What broke Verified locally end-to-end against real Kafka (built the Scope change: I'd also staged a Generated by Claude Code |
Description
This change makes the
storeoption mandatory for MQTT server bindings by enforcing it at the schema validation level, rather than relying on runtime warnings.Changes
Schema & Validation:
mqtt.schema.patch.jsonto requireoptionswith astoreproperty for server bindingsserver.without.store.yamltest configuration to verify that configurations without a store are rejectedshouldRejectServerWithoutStore()to ensure the requirement is enforcedCode Cleanup:
MqttServerFactory.attach()that warned about missing store configurationwarnSessionOwnershipDeprecated()method that is no longer neededConfiguration Updates:
mqtt.kafka.proxy,mqtt.proxy.jwt) to include store setupBug Fix:
MqttKafkaSessionFactoryto only process unacked packet IDs when the queue is not empty, preventing unnecessary stream creationRationale
By moving the store requirement from a runtime warning to a schema-level constraint, configurations are validated at load time rather than runtime. This ensures all MQTT server bindings have proper session storage configured before the application starts, improving reliability and preventing runtime surprises.
Test Plan
Existing schema validation tests pass, including the new test that verifies rejection of server configurations without a store. All updated example and test configurations now include proper store configuration.
https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp