Skip to content

feat(binding-mqtt-kafka): emit an event when a Kafka stream failure closes an MQTT stream - #3313

Closed
jfallows wants to merge 1 commit into
developfrom
feat/3308-mqtt-kafka-reset-events
Closed

jfallows wants to merge 1 commit into
developfrom
feat/3308-mqtt-kafka-reset-events

Conversation

@jfallows

Copy link
Copy Markdown
Contributor

Description

Since #3104 a failed Kafka stream is forwarded to the MQTT side as a reset or abort. Those closes emit no event, so a v3.1.1 client that gets a plain close after CONNACK leaves nothing in the log.

This adds the binding.mqtt.kafka.stream.failed event (BINDING_MQTT_KAFKA_STREAM_FAILED). It is emitted where a Kafka stream failure closes an MQTT session, publish or subscribe stream, and it carries:

  • the Kafka stream kind: session, will signal, meta, describe, offset fetch, offset commit, init producer id, produce, fetch
  • the client id
  • the topic, or the group for offset fetch
  • whether the MQTT session reply had already begun, worded as "before" or "after" the client was connected

Example: The Kafka meta stream for topic (mqtt-messages) failed before MQTT client (client-1) was connected, the MQTT stream was closed.

The event is only emitted when the MQTT stream is not already closed. A QoS 1 produce reset that is answered with a negative acknowledgement and leaves the MQTT stream open does not emit it. Only the Kafka abort and reset handlers are covered. Window-overflow aborts and the cleanup helpers are not.

The change is additive: one line at each existing reset or abort site. onPartitionsAborted and onPartitionsReset gain a topic parameter so the meta failure can name its topic.

Tests (engine ITs in the existing IT classes, reusing the existing server-sent reset and abort scripts, each asserting the event through the test exporter config): session, meta, init producer, offset fetch, produce and fetch. They failed before the change with event mismatch ... actual: ENGINE_STOPPED.

Verified with ./mvnw clean install on specs/binding-mqtt-kafka.spec (418 tests) and ./mvnw clean verify on runtime/binding-mqtt-kafka (105 unit tests, 249 ITs, checkstyle and jacoco).

Refs #3308


Generated by Claude Code

…loses an MQTT stream

Add the binding.mqtt.kafka.stream.failed event, emitted wherever a failed
Kafka stream (session, will signal, meta, describe, offset fetch, offset
commit, init producer id, produce, fetch) is turned into a reset or abort
of the MQTT session, publish or subscribe stream. It carries the stream
kind, the client id, the topic or group where known and whether the MQTT
session reply had already begun, so a close that carries no reason to a
v3.1.1 client is diagnosable.

Refs #3308

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01SiHVoVsdTvsCTRmsCKGSdD
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants