Repository navigation
feat(binding-mqtt)!: require store on mqtt server binding - #1964
Merged
Merged
Conversation
PR #1806 dropped the memory store from the mqtt.kafka.proxy example and from the asyncapi-generated mqtt server binding, but the store-based MQTT session ownership introduced in that PR requires a store on the mqtt server binding. Without it the example smoke tests for mqtt.kafka.proxy and asyncapi.mqtt.kafka.proxy fail to complete the MQTT CONNECT. - examples/mqtt.kafka.proxy: declare a memory store and reference it from the north_mqtt_server binding - binding-asyncapi: inject a memory store into the generated mqtt_server0 binding in the server composite namespace Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
Session ownership now depends on a configured store, so make the 'store' option (and therefore 'options') required on the mqtt binding when kind: server. This is a breaking change targeted at the upcoming major release. - mqtt schema: mark options + options.store required for kind: server. - MqttServerFactory: drop the now-dead 'session ownership will require the store option' deprecation warning (and the unused KindConfig import). - binding-mqtt.spec: add a 'test' store to every mqtt server config that lacked one (17 fixtures), add server.without.store.yaml, register the engine store test schema patch in SchemaTest, and add shouldRejectServerWithoutStore. - asyncapi: the server generator already injects a memory store for the generated mqtt_server0; expose 'store' on the asyncapi mqtt options so it can be overridden, defaulting to the generated mqtt_store0. - examples/mqtt.proxy.jwt: declare a memory store on the mqtt server. Verified: binding-mqtt + binding-asyncapi unit tests and binding-mqtt.spec SchemaTest pass; mqtt.kafka.proxy and asyncapi.mqtt.kafka.proxy example smoke tests pass end-to-end against real Kafka with store required, and the mqtt.proxy.jwt config validates and starts. k3po integration tests were not run locally (control agent unavailable in this environment) and rely on CI. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
…ions When options.mqtt.store is set, the asyncapi server generator now references that store from the enclosing namespace by qualified name (mirroring the authorization qname pattern) instead of minting a memory store, so operators can point the generated mqtt server at a shared/cluster-wide store. When absent, the generator still mints the default mqtt_store0 memory store. - AsyncapiServerGenerator: resolve options.mqtt.store to a qname via supplyQName(resolveId(name)) and inject it on the generated mqtt_server0; mint mqtt_store0 only when no external store is configured. - binding-asyncapi.spec: add server.mqtt.store.yaml fixture (external store referenced from options.mqtt.store), register the engine store test schema patch, and add shouldValidateMqttStoreServer to SchemaTest. - binding-asyncapi: add shouldPublishAndSubscribeWithStore to AsyncapiServerIT, exercising the generated composite against an external store. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
… loop Store-based session ownership (#1806) assumed asynchronous store callbacks, driving completeOwnership (and its decodeNetwork) directly from store.get/lock callbacks. A synchronous store (e.g. the engine test store) fires those callbacks inline, so the whole ownership chain ran re-entrantly inside the network decode loop. That re-entrant decode re-processed the unconsumed CONNECT payload as a second packet, causing the server to abort the session stream and reply CONNACK 0x82 on a guarded connect. Defer ownership acquisition by one tick via a new SIGNAL_ACQUIRE_SESSION_OWNERSHIP so doAcquireOwnership and the decode resume always run on a clean signal stack -- never nested in the decode loop. Consume the CONNECT payload before awaiting ownership so it is not re-decoded once ownership resolves, and cancel the pending signal on ownership release. Configure short session lease/renew on the two server.yaml takeover ITs (shouldClientTakeOverSession, shouldCloseExistingConnectionCleanStart), matching shouldTakeOverSession: with a store, takeover steals after session.renew, whose PT10S default coincides with the 10s test timeout. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
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.
Summary
Makes a configured
storerequired on themqttbinding whenkind: server. Store-based MQTT session ownership (introduced in #1806) depends on a store being present; without one the server cannot complete a CONNECT. This is a breaking change targeted at the upcoming major release.Also exposes
options.mqtt.storeon theasyncapibinding so the generatedmqtt_server0can be pointed at a shared/cluster-wide store instead of the default minted memory store.Commits
fix(binding-mqtt): restore memory store on mqtt server session ownership — [2.0] Refactor MQTT session management to use store-based persistence #1806 dropped the memory store from themqtt.kafka.proxyexample and the asyncapi-generated mqtt server; restore it so session ownership works.feat(binding-mqtt)!: require store on mqtt server binding — markoptions+options.storerequired forkind: serverin the schema; drop the now-dead deprecation warning inMqttServerFactory; add ateststore to the 17 server spec fixtures; addserver.without.store.yaml+shouldRejectServerWithoutStore; declare a memory store on themqtt.proxy.jwtexample.feat(binding-asyncapi): reference external/cluster store for mqtt options — whenoptions.mqtt.storeis set, the server generator references it by qualified name (mirroring the authorization qname pattern) instead of mintingmqtt_store0. Addsserver.mqtt.store.yaml+shouldValidateMqttStoreServerand anAsyncapiServerITcase exercising the generated composite against an external store.Testing
Verified locally:
binding-mqtt.specSchemaTest(incl.shouldRejectServerWithoutStore)binding-asyncapi.specSchemaTest— 12 tests, incl. newshouldValidateMqttStoreServerbinding-mqttunit tests (49) andbinding-asyncapiconfig-adapter tests (8)mqtt.kafka.proxyandasyncapi.mqtt.kafka.proxyexample smoke tests pass end-to-end against real Kafka with store required;mqtt.proxy.jwtconfig validates and startsk3po integration tests (
MqttServerIT,AsyncapiServerIT) could not run in the development environment (k3po control agent unavailable) and rely on CI. The engine'stype: teststore fully implements the session-ownership contract (get/lock/watch/renew, callbacks dispatched on the worker loop), so the store-gated CONNECT completes under the test store.🤖 Generated with Claude Code
https://claude.ai/code/session_01Vx4B6SkggrTs8EEEenxPtp
Generated by Claude Code