Hi @brigadier90 , My apologies for duplication of terms. It’s a hazard of repurposing material for different groups. In the text a Consumer Group Client is the same as an LBG Client and is the same as the Consumer Group Consumer.
In terms of the code snippet there are a number of attributes that are related and govern which queues a client thinks it is responsible for -
The total number of queues - loop counts through the queues in the snippet. The max number of LBG clients (clientCount) that will run. clientCount <= queueCount The LBG Client number (clientNumber) - an index of the client within the group, e.g., if there are 10 clients each will have a number 0 - 9 What the code needs to do is work out which of all of the queues that a client is connected to (which will be all of the queues) are primary queues for that client. So if I have 10 queues and 5 clients then each client will connect to all to queues. However, client 0, for example, will treat Q0 and Q5 as primary, client 1, Q1 and Q6 as primary, etc.
In the LBG Client code once you once you have processed and ACKed your message / completed your transaction, check to see if the allowed time has passed (60s in the blog). If the time has passed has then walk through the list of queues and close and recreate the flows to all queues for which this client does not count as primary. This action will eventually ensure that the client that does count the queue as primary end up servicing it.
When the LBG client is started it must be started knowing it clientNumber / index within the group.
I hope that helps. Let me know if you need anything else.
/Mat