Notification2 and shared consumers

I’ve understood with having multiple shared consumers for a Notification2 subscription the load will be partitioned by source.id and balanced to all consumers. I’ve implemented this in one of my services and it works very well for me.

However, I did not fully understand what will happen in following scenario: I have one Subscription S1, a shared token and four shared consumers C1, C2, C3 and C4 that are using the token. Now C3 is losing connectivity for whatever reason, the others are still connected.

  • When does the platform start to route messages for C3 to the other clients? Immediately on websocket-disconnect or is there some time the platform waits for potential reconnect?
  • What will happen with C3s message backlog? I guess it will be distributed to the other consumers? When?

A Notification 2.0 ‘shared’ subscription is a Key_Shared subscription.

The moment the broker detects C3’s connection is lost, C3 is removed from the list of active consumers for subscription S1, and the broker triggers a rebalance. The source.id keys that were assigned to C3 are then redistributed among the remaining healthy consumers: C1, C2, and C4.

C3’s unacked backlog is also scheduled for redelivery to C1, C2, and C4. This might have a slight delay depending on whether or not C3’s disconnect was graceful or not.

2 Likes