Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
If you wish to have EventProcessorHost store leases somewhere other than Azure Storage, you can write your own lease manager using this interface.
The Azure Storage managers use the same storage for both lease and checkpoints, so both interfaces are implemented by the same class. You are free to do the same thing if you have a unified store for both types of data.
This interface does not specify initialization methods because we have no way of knowing what information your implementation will require.
public interface ILeaseManager
type ILeaseManager = interface
Public Interface ILeaseManager
Mostly useful for testing.
Allows a lease manager implementation to specify to PartitionManager how often it should scan leases and renew them. In order to redistribute leases in a timely fashion after a host ceases operating, we recommend a relatively short interval, such as ten seconds. Obviously it should be less than half of the lease length, to prevent accidental expiration.
Acquire the lease on the desired partition for this EventProcessorHost.
Note that it is legal to acquire a lease that is already owned by another host. Lease-stealing is how partitions are redistributed when additional hosts are started.
Create in the store the lease info for the given partition, if it does not exist. Do nothing if it does exist in the store already.
Create the lease store if it does not exist, do nothing if it does exist.
Delete the lease info for the given partition from the store. If there is no stored lease for the given partition, that is treated as success.
Not used by EventProcessorHost, but a convenient function to have for testing.
Return the lease info for all partitions. A typical implementation could just call GetLeaseAsync() on all partitions.
Return the lease info for the specified partition. Can return null if no lease has been created in the store for the specified partition.
Does the lease store exist?
Give up a lease currently held by this host.
If the lease has been stolen, or expired, releasing it is unnecessary, and will fail if attempted.
Renew a lease currently held by this host.
If the lease has been stolen, or expired, or released, it is not possible to renew it. You will have to call getLease() and then acquireLease() again.
Update the store with the information in the provided lease.
It is necessary to currently hold a lease in order to update it. If the lease has been stolen, or expired, or released, it cannot be updated. Updating should renew the lease before performing the update to avoid lease expiration during the process.
Submit and view feedback for