question

SagarPatil-8321 avatar image
0 Votes"
SagarPatil-8321 asked KranthiPakala-MSFT commented

Event hub manual failover - EventProcessorClient checkpoint issue

In case of performing manual failover operation on event hub namespace, consumer application with EventProcessorClient which is continuously listening to event hub with alias name connection string failed as checkpoint store value changes while event hub namespace switch to secondary namespace.

To resolve we are using ProcessErrorAsync event to again initialize new EventProcessorClient and start listening again with StartProcessingAsync() method and also clearing existing checkpoint store blob.

Is it the correct way or any better approach recommended?

Sample code -
protected async Task ProcessErrorHandler(ProcessErrorEventArgs eventArgs)
{
if (eventArgs.Exception.InnerException is AmqpException && ((System.Type)((System.Reflection.MethodInfo)eventArgs.Exception.InnerException.TargetSite).DeclaringType).Name is "ExceptionDispatchInfo")
{
await processor.StopProcessingAsync();

             processor = new EventProcessorClient(storageClient, _consumerGroup, 
                                       _ehubNamespaceConnectionString, _eventHubName);
             await ClearCheckpointStore();// only to delete existing checkpoint file. so that it will create new checkpoint file with eventhub namespace2 checkpoint values.


             // Register handlers for processing events and handling errors
             processor.ProcessEventAsync += ProcessEventHandler;
             processor.ProcessErrorAsync += ProcessErrorHandler;
             await processor.StartProcessingAsync();
         }
         else
         {
             // handle other exception needed.

         }
     }
azure-event-hubs
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

KranthiPakala-MSFT avatar image
0 Votes"
KranthiPakala-MSFT answered KranthiPakala-MSFT commented

Hi @SagarPatil-8321,

Welcome to Microsoft Q&A forum and thanks for your query.


Failover is a manual process and user should restart consumers after resetting the checkpoints once failover is complete. As per my conversation with product team, it is not recommended automating the process by looking at some failure from service.

Do let us know if you have further query.

Thanks

· 6
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @SagarPatil-8321,

Following up to see if you still need assistance on this query? Do let us know if you have further questions.

THanks

0 Votes 0 ·

Hi @SagarPatil-8321,

We still have not heard back from you. Just wanted to check if the above suggestion was helpful? If it answers your query, please do click “Accept Answer” and/or Up-Vote, as it might be beneficial to other community members reading this thread. And, if you have any further query do let us know.

0 Votes 0 ·

Hi @KranthiPakala-MSFT I got your point however problem is on manual failover, we do not want to restart consumer as we might have many consumer and wanted to avoid this manual restart.(all consumer should not know about failover and should work smoothly without interruption)

And if we do not use above code then currently Azure is not handling it automatically and EH receiver is throwing
"The supplied offset '55838201792' is invalid. The last offset in the system is '30089580512'" error.
Is there any chance that Azure event hub will handle this issue? Looks like event hub receivers are not compliant with failover yet.

0 Votes 0 ·

Hi @sagarpatil-8321,

Thanks for your response. I did double checked with product team and confirmed that consumers need to failover when service fails over. No alternatives at the moment.
But it could be a feature request for the product.

Hence I would recommend you to please log an idea/suggestion in Azure Event hubs user voice forum: https://feedback.azure.com/forums/911458-event-hubs
All the feedback shared in this forum are moderated and reviewed by product team and will take accordingly. Please do share the link here once the feedback is posted so that other with similar idea can upvote and comment on your suggestion which would also help to increase the priority.

Hope this info helps.

0 Votes 0 ·

Thanks @KranthiPakala-MSFT I will do the needful.

0 Votes 0 ·
Show more comments