jamesnetherton opened a new pull request, #31181: URL: https://github.com/apache/camel/pull/31181
[CAMEL-27900](https://issues.apache.org/jira/browse/CAMEL-27900) A streaming consumer whose subscription the server rejects stayed unsubscribed after the connection recovered, until the next handshake or a route restart. CAMEL-23391 (d758b2d18347) stopped adding a channel to `channelsToSubscribe` in `subscribe()`, to stop duplicate event delivery. Before that, a channel stayed in the set until a subscription succeeded, so the next successful `/meta/connect` retried it. Now a rejected channel is never subscribed again. The regression was first released in 4.21.0. ## Changes - When `SubscriptionHelper` gives up on a subscription, it puts the channel back in `channelsToSubscribe`, so the next successful connect retries it. A channel that the server reports as invalid is still dropped. Only a rejected subscription is re-queued, so the duplicate delivery fixed by CAMEL-23391 does not come back. - With several consumers on one channel, CometD sends `/meta/subscribe` only for the first listener, and a rejection removes only that listener. The remaining listeners kept every retry local to the client, so the channel was never subscribed again. This also affected the existing temporary-error and invalid-replayId retries. On a subscription failure, the remaining listeners of the channel are now removed first, so the retry reaches the server. Removing the last one sends a `/meta/unsubscribe` for a channel the server never subscribed: Salesforce answers it with a 400 error and no advice, and the session stays alive. - As before CAMEL-23391, a channel that the server keeps rejecting is retried on every successful connect, and each attempt is reported to the consumer's exception handler. ## Tests `SubscriptionHelperManualIT.shouldResubscribeOnSubscriptionFailure` caught the regression but only runs in the manual profile. It moves to the new `SubscriptionHelperSubscriptionFailureTest`, which runs against the stub server in the regular build, with a new case for two consumers on one channel. _Claude Code on behalf of jamesnetherton_ 🤖 Generated with [Claude Code](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
