Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

EPOCH Error while communicating with Azure Event Hub

I am using Azure Event Hub for listening to real-time data in my application. Most of the times, it works fine but sometimes it throws the following error -

New receiver with higher epoch of '3109' is created hence current receiver with epoch '3108' is getting disconnected. If you are recreating the receiver, make sure a higher epoch is used. TrackingId:eb2a6f970000494500f379f85b484a9f_C-1553490498_B22, SystemTracker:xxxxxxxxxx:eventhub:xxxxxxx~2730|$default, Timestamp:7/13/2018 6:48:54 AM.

and application stops processing data. I have gone through several articles on the net but not able to find any solution. On MSDN, I read

that EPH relies on the fact that "there can only be 1 active epoch receiver on a consumer group at any given time

but I am not sure how to ensure that there will be only 1 active epoch. Also, the same Event Hub is utilized by three different environments i.e. Development, Test, Production.

Any suggestions are highly appreciated..

like image 548
Anil Avatar asked Jul 20 '18 11:07

Anil


1 Answers

It sounds like you are running two instances of the application, two concurrent classes, or two applications that use the same event hub consumer group. Event hub consumer groups are effectively pointers to a point in time on the event stream. If you try and use one consumer group with two instances of code, then you get a conflict like the one you are seeing.

Either:

  1. Ensure you only have a single instance reading the consumer group at a time.
  2. Use two consumer groups when you need two separate programs or sets of functionality to process the event hub at the same time.
  3. If you are looking to parallelize for performance, look in to event hub Partitioning and how to take advantage of processing each partition independently.

There is also an alternative scenario where an event hub partition is switched over to another host as part of the event hub's internal load balancing. In this case you may see the error you are receiving. In this case, just log it and continue on.

Here is some good documentation to help you on your way.

like image 147
Murray Foxcroft Avatar answered Sep 20 '22 12:09

Murray Foxcroft