TryMe
TryMe

Reputation: 25

EventHub consumer with MediatR only handle 3 events in parallel

I followed the Microsoft's doc here to consume events from EventHubs. When my application consumes the event, they are handled by Mediatr, the process takes an average of 1 second to process data inside my handler (I'm working to reduce this time, but that's not the focus here).

The handler looks like this:

public class EventHandler : IRequestHandler<MyEvent, bool>
{
    // Do something...
}

If I publish 300 messages (number doesn't matter, just an example), I notice that the handler was processing 3 messages per time (300/3 * 1 = 100s), I wanted to decrease the time to less than 30s, first I thought it was processing 3 per time because I was using 3 partitions for that topic, so I increased to ten partitions expecting to have 10 calls simultaneous to my handler, but it's keeping calling 3 times, I checked the partitions and eventhubs is balancing the events between all the 10 partitions, so I think it's something with mediatR, anyone knows if there's a limitation or do I need to set some config to handle more than 3 at time?

Upvotes: 0

Views: 44

Answers (0)

Related Questions