This post has been republished via RSS; it originally appeared at: Microsoft Tech Community - Latest Blogs - .
Are you seeing logs where Epoch ‘0’ is getting disconnected? Does your consumer group consist of numerous consumers but only one partition? If so, this article will help you understand why you are getting such informative logs.
I. What is Epoch?
Epoch is a unique identifier (epoch value) that the service uses, to enforce partition/lease ownership. Thus, epoch features allow one consumer to have exclusive access to a partition despite the competition from other consumers from the same consumer group to use that same partition. This protocol is used from the Event Processor Host (EPH) SDK by using CreateEpochReceiver method. For more information, please visit the following link.
II. Why am I getting disconnected log?
Are you seeing the log as shown below?
New receiver 111111-11111-1111-11111 with higher epoch of '0' is created hence current receiver 000000-000000-00000-0000-0000000 with epoch '0' is getting disconnected. If you are recreating the receiver, make sure a higher epoch is used.
That’s because a new consumer is trying to access and connect to the partition where there was already a consumer receiving the events from that partition. Thus, the previous consumer is being disconnected to allow the new consumer to use the partition. As mentioned before, there is competition amongst the consumers.
This log does not mean that there’s an error. Since the partition can only be accessed by one consumer at a time when using Epoch method. Therefore, the partition must release the old consumer to let the new consumer access it. Therefore gradually, you would see a disconnection from the old one to the newest one.
III. Can I not get this logged or any other way to not see this?
The answer to this question is yes and no, depending on your environment. Please be mindful of your environment before using No Epoch method. There is a way to do so, but it comes with a restriction. The way is by using No Epoch method (CreateReceiver method). By using this method, you can create multiple consumers on a single consumer group. However, the concurrent consumers are limited to 5 consumers. Thus, if you are using more than 5 consumers then No Epoch method will not help.
For more information please check this link.
If you are seeing the log message, your consumers are fighting and competing to get access to the partition. However, if no consumers are being added or removed during the process, then there is a problem. If this happens, do not hesitate to contact us for support.