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

any way to retrieve skipped event using EventProcessorHost in azure event hub?

$
0
0

I'm using azure event hub's EventProcessorHost to process batch of events. For some reason I have to skipped events by not writing checkpoint when the threads count has reached the maximum, but I have to retrieve those skipped events after the threads count come down. Please see the implementation below:

async Task IEventProcessor.ProcessEventsAsync(PartitionContext context, IEnumerable<EventData> messages)
    {
        //Process Events
        foreach (var eventData in messages)
        {
            if (Process.GetCurrentProcess().Threads.Count <= 50)
                {
                    //do work
                    await context.CheckpointAsync(eventData);
                }
                else
                {
                    //do not write Checkpoint
                    break;
                }
        }
    }

This is a simple and straightforward logic but it's not working as what I expected. Once the "break" line hit the "foreach" breaks, I expect those skipped events will show up in the next "ProcessEventsAsync", but they never come again until the worker role recycle and re-register the "EventProcessorHost".

I have stuck in this issue for a few days please someone figure out what I've missed.

Many Thanks in advance!



Viewing all articles
Browse latest Browse all 1916

Trending Articles