Quantcast
Channel: Service Bus forum
Viewing all articles
Browse latest Browse all 1916

Is there a recommend way for the event failed been processed?

$
0
0

For instance, we have an Event Hub which including 100 events (EventData instances, event1…..event100), and we use EventProcessorHost to consume data (below code),

publicasyncTask ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> events)

       {

           foreach (var eventData in events)

           {

               var content =Encoding.UTF8.GetString(eventData.GetBytes());

               // Do some calculation, during the calculation we got exception.

              // Recommended way to calculate it again

               Console.WriteLine("Get message: partitionId:{0}, message:{1}", context.Lease.PartitionId, content);

           }

           if (_checkpointStopWatch.Elapsed >TimeSpan.FromMinutes(5))

           {

               await context.CheckpointAsync();

               lock (this)

               {

                   _checkpointStopWatch.Reset();

               }

           }

       }

After we got the events, we will do some calculation with them, during the calculation for events, we got an exception for some reason (not related to EventProcessorHost), eg: when we got the event50, we want to calculate it with some functions, but we got some info it means the calculation failed, we want to calculate it again. So is there aRecommend wayto do with the failed events. Something like: we can add some tag or marked Event50 is failed data, and told EventHub we want to calculate it again?

Thanks!


Viewing all articles
Browse latest Browse all 1916

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>