Federico Mariani created CAMEL-23291:
----------------------------------------

             Summary: EventHubs and Google PubSub consumers lack ShutdownAware 
support, causing potential message loss during graceful shutdown
                 Key: CAMEL-23291
                 URL: https://issues.apache.org/jira/browse/CAMEL-23291
             Project: Camel
          Issue Type: Bug
          Components: camel-azure-eventhubs, camel-google-pubsub
    Affects Versions: 4.18.1
            Reporter: Federico Mariani


_EventHubsConsumer_ and _GooglePubsubConsumer_ do not implement ShutdownAware. 
Both consumers close/stop their underlying client immediately in _doStop()_, 
without waiting for in-flight exchanges to complete. This is the same root 
cause that was fixed for ServiceBusConsumer in 
[CAMEL-23260|https://issues.apache.org/jira/browse/CAMEL-23260].

When a SIGTERM is received while messages are being processed:
- EventHubsConsumer.doStop() calls processorClient.stop() and sets it to null 
immediately
- GooglePubsubConsumer.doStop() calls stopAsync() on all subscribers and shuts 
down the executor

In both cases, in-flight exchanges may fail to ACK/NACK their messages because 
the underlying client connection is torn down before the exchange completion 
callbacks run. This can lead to message redelivery and duplicate processing.

Both consumers should implement ShutdownAware following the pattern established 
in CAMEL-23260:
- deferShutdown() should stop the message pump while keeping connections alive
- getPendingExchangesSize() should track in-flight exchanges
- Client resources should only be fully closed in doShutdown(), after all 
exchanges have drained



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to