3

Does anyone know where I can find details about how event hub lease management works? Specifically I'm trying to find how do I know where in the event hub the EventProcess picks up processing (after a reboot, shutdown, lease lost)? What is the best way to set the index to the beginning during development?

Thanks

Dan Ciborowski - MSFT
  • 6,807
  • 10
  • 53
  • 88
user1116536
  • 373
  • 1
  • 5
  • 11

1 Answers1

0

This article does a good job of explaining lease management in EventHub under distributed consuming applications :

Lease management

Registering an event processor class with an instance of EventProcessorHost starts event processing. The host instance obtains leases on some partitions of the Event Hub, possibly grabbing some from other host instances, in a way that converges on an even distribution of partitions across all host instances. For each leased partition, the host instance creates an instance of the provided event processor class, then receives events from that partition, and passes them to the event processor instance. As more instances get added and more leases are grabbed, EventProcessorHost eventually balances the load among all consumers.

As explained previously, the tracking table greatly simplifies the autoscale nature of EventProcessorHost.UnregisterEventProcessorAsync. As an instance of EventProcessorHost starts, it acquires as many leases as possible, and begins reading events. As the leases near expiration, EventProcessorHost attempts to renew them by placing a reservation. If the lease is available for renewal, the processor continues reading, but if it is not, the reader is closed and CloseAsync is called. CloseAsync is a good time to perform any final cleanup for that partition.

EventProcessorHost includes a PartitionManagerOptions property. This property enables control over lease management. Set these options before registering your IEventProcessor implementation.

rahulaga-msft
  • 3,964
  • 6
  • 26
  • 44