shaipan commented on PR #22874:
URL: https://github.com/apache/camel/pull/22874#issuecomment-4358877311
@gnodet During testing we discovered that subscribe() was adding the channel
back to channelsToSubscribe via channelsToSubscribe.add(channelName). Since the
connection listener takes a snapshot of channelsToSubscribe, clears it, and
calls subscribe() for each consumer — subscribe() was re-adding the channel,
causing the next connect cycle to find it non-empty and call subscribe() again.
This stacked duplicate CometD listeners on the same channel, resulting in each
event being delivered N times (once per stacked listener, where N = number of
connect cycles since handshake).
The fix removes channelsToSubscribe.add(channelName) from subscribe(). This
is safe because channelsToSubscribe is only meant to track channels pending
subscription after a handshake — the handshake listener populates it from
channelToConsumers.keySet(), which already includes the channel after
channelToConsumers.computeIfAbsent(...).add(consumer).
--
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]