Repository navigation
feat(mqtt): dispatch embedded inbound publishes from the session loop (design 054 §4.7) - #286
Merged
Conversation
… (design 054 §4.7) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stage 9 of the 054 implementation plan. The embedded MQTT session delivers each inbound publish straight into its records from
drain_packets, while it still holds the decoded packet. The event channel,MqttSourceand thepump_sourcetask are gone. Outbound still goes through the action channel andpump_sinkuntil stage 10.Change
embedded/mod.rs:build_plainandbuild_tlsbuildInboundDispatch::new(db, "mqtt", &MqttGrammar)instead ofinbound_router, and subscribe itssubscriptions().setup_manager/setup_tls_managerandrun_sessions/run_tls.AimdbMqttEventwith its conversion,EventChannel,MqttSource, and thepump_sourcecall.aimdb_mqtt_connector::embedded::AimdbMqttEventwas public.manager.rs: theEventChannelalias and the crate-privateFromApplicationMessagetrait are removed.session_loop.rs:run_session,client_loopanddrain_packetstake&InboundDispatch, nameddispatchbecause the raw-chunk channel is already calledinbound.delivercallsdispatch.dispatch(publish.topic_name(), publish.payload())forPublishandPublishAndPuback. It keeps the empty-topic check, the liveness-only events and the DISCONNECT error.Receivedis gone.PacketReader::head_needs_ack), not before every packet.connector.rs: theEmbeddedrustdoc says what QoS 1 inbound means now: the PUBACK goes out before delivery, so it means "reached AimDB". A record whose buffer is full drops the message, and the broker does not resend.setup_tls_managertakes 8 arguments now and gets#[allow(clippy::too_many_arguments)], as the session loop's long signatures already do. Stage 10 replaces the action channel there.Net: +170 / −171 in
aimdb-mqtt-connector, tests included.Tests
the_embedded_backend_dispatches_inbound_on_its_session_task(tokio_broker): with an inbound link and no outbound ones,build()returns one future. Against the previous code the same test sees 2, which I checked by running it on the oldsrc/.only_a_publish_above_qos_0_needs_an_ack(packet_reader).InboundDispatchover an empty database (NoopRuntimeOps) and still passes the ≤ 8,192-byte bound.Existing suites, unchanged and passing:
session_loop(QoS 1 delivery, inbound flood, ping cadence)tokio_broker(reconnect/resubscribe, round trip, Maximum Packet Size, new count test)embassy_brokertls_sessiontls_brokerbackend_paritywrite_ring_proofs--features stdembedded-tlslibVerification
aimdb-mqtt-connectorclippy leg (host, test targets,thumbv7emincludingembassy-tls+defmt) and every doc leg (-D warnings) from the Makefile: clean.cargo fmt --all --check: clean.embassy-mqtt-connector-demoandweather-station-gammabuild forthumbv8m.main-none-eabihf.feat/054-connector-boundary.🤖 Generated with Claude Code