[
https://issues.apache.org/jira/browse/CAMEL-27383?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Work on CAMEL-27383 started by shashank.
----------------------------------------
> camel-vertx-mqtt - the consumer stops reading after a restart on the
> connection of its producer, drops the messages a kept session sends right
> after the CONNACK, and does not redeliver a message that failed on two
> connections
> ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Key: CAMEL-27383
> URL: https://issues.apache.org/jira/browse/CAMEL-27383
> Project: Camel
> Issue Type: Bug
> Components: camel-vertx
> Reporter: shashank
> Assignee: shashank
> Priority: Major
>
> h3. What happens
> Three cases in the consumer of camel-vertx-mqtt (CAMEL-26735):
> # *Restart on a shared connection.* Stopping the consumer pauses the client.
> When a producer of the same endpoint holds the connection, it is not stopped
> and nothing resumes it. The restarted consumer receives nothing, the
> producer's QoS 1 and 2 publishes fail with the ack timeout (the PUBACK is not
> read), and the keep alive drops the connection every 1.5 keep alive
> intervals, after which the new client is paused again.
> # *Kept session.* The consumer subscribes (sets the message handler) after
> the connection connected. A broker that kept the session
> ({{cleanStart=false}}) sends the messages it holds right after the CONNACK;
> they find no handler and are dropped. With automatic acknowledgements the
> Vert.x client acknowledges them anyway, so they are lost; with manual
> acknowledgements they stay in flight. Without {{automaticReconnect}} this
> always happens, with it it is a race. Same as CAMEL-25944 for camel-paho.
> # *Redelivery after a reconnect.* A failed message is redelivered by closing
> the connection, but the consumer keeps only the client of the first failure.
> When the connection dropped while the message was processed, the old copy
> fails first, then the copy the session sent on the new connection fails too:
> no close happens, and the message stays unacknowledged until the connection
> drops.
> h3. How to reproduce
> # A route from {{vertx-mqtt:a?qos=1}} and a route to the same URI. Stop and
> start the consumer route, then send with the producer: it fails with the ack
> timeout, and the consumer receives nothing.
> # A broker that answers the CONNECT with session present and sends a QoS 1
> message right after the CONNACK, a consumer with
> {{cleanStart=false&automaticReconnect=false}}: the message never reaches the
> route.
> # Manual acknowledgements, a kept session, a route that fails: drop the
> connection while the first copy is processed; both copies fail and the
> message is not delivered again.
> Found with a TLA+ model.
> h3. Fix
> The consumer resumes the connection when it stops, after it unsubscribed, if
> a producer still holds it (a connection that stops with the consumer stays
> paused, so the messages waiting unread are not acknowledged). A connection
> the consumer starts gets the subscription before it connects. The consumer
> keeps every client a failed message arrived on, and closes for the redelivery
> when one of them is the current client.
> _Filed with Claude Code on behalf of allthingssecurity._
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)