#### [Abblix\.SharedSignals](https://www.abblix.com/en/docs/api/abblix-sharedsignals 'index')
### [Abblix\.SharedSignals\.Transmitter](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter 'Abblix\.SharedSignals\.Transmitter')

## IDeliveryLease Interface

A claim on one named piece of delivery work, held for a bounded time, so that among however
many transmitter instances are running exactly one performs it\.

```csharp
public interface IDeliveryLease
```

Derived  
↳ [ProcessLocalDeliveryLease](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.ProcessLocalDeliveryLease 'Abblix\.SharedSignals\.Transmitter\.ProcessLocalDeliveryLease')

### Remarks

Push delivery reads a stream's queue and empties it as receipts come back, so two instances
sweeping one stream both read the same pending SETs and both POST them. RFC 8935 Section 2
permits a receiver to be sent the same SET again - "The SET Recipient MUST respond as it would
if the SET had not been previously received" - but binds the transmitter the other way: it
"should not retransmit a SET unless the SET Transmitter suspects that previous transmissions
may have failed due to potentially recoverable errors", and "in all other cases, the SET
Transmitter SHOULD NOT retransmit a SET". Instances duplicating each other's work suspect
nothing, so this is that SHOULD NOT rather than a matter of wasted traffic.

The claim EXPIRES, and that is what separates it from a lock. Expiry is what lets an instance
that died mid-pass release its claim without running any code - nothing else would - and it is
therefore also the point past which the holder has no claim at all. So a holder must stop the
work at its deadline rather than treat the lease as advice: whoever comes next is entitled to
start, and two workers overlapping is the very thing being prevented.
### Methods

## IDeliveryLease\.TryAcquireAsync\(string, TimeSpan, CancellationToken\) Method {#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken)}

Claims [name](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IDeliveryLease#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken).name 'Abblix\.SharedSignals\.Transmitter\.IDeliveryLease\.TryAcquireAsync\(string, System\.TimeSpan, System\.Threading\.CancellationToken\)\.name') for at most [duration](https://www.abblix.com/en/docs/api/abblix-sharedsignals/Abblix.SharedSignals.Transmitter.IDeliveryLease#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken).duration 'Abblix\.SharedSignals\.Transmitter\.IDeliveryLease\.TryAcquireAsync\(string, System\.TimeSpan, System\.Threading\.CancellationToken\)\.duration')\.

```csharp
System.Threading.Tasks.Task<System.IAsyncDisposable?> TryAcquireAsync(string name, System.TimeSpan duration, System.Threading.CancellationToken cancellationToken=default(System.Threading.CancellationToken));
```
#### Parameters

###### `name` [System\.String](https://learn.microsoft.com/en-us/dotnet/api/system.string 'System\.String') {#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken).name}

What is being claimed\. Callers scope it themselves, so two kinds of work over one stream do
not collide\.

###### `duration` [System\.TimeSpan](https://learn.microsoft.com/en-us/dotnet/api/system.timespan 'System\.TimeSpan') {#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken).duration}

How long the claim holds without being released\. It bounds two opposite costs: too short
cuts a legitimate pass off and the work is redone next time, too long parks the work for
the remainder after the holder dies\. Both are safe, so err on whichever the deployment
minds less\.

###### `cancellationToken` [System\.Threading\.CancellationToken](https://learn.microsoft.com/en-us/dotnet/api/system.threading.cancellationtoken 'System\.Threading\.CancellationToken') {#Abblix.SharedSignals.Transmitter.IDeliveryLease.TryAcquireAsync(string,System.TimeSpan,System.Threading.CancellationToken).cancellationToken}

Cancels the I/O a shared implementation performs\.

#### Returns
[System\.Threading\.Tasks\.Task&lt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')[System\.IAsyncDisposable](https://learn.microsoft.com/en-us/dotnet/api/system.iasyncdisposable 'System\.IAsyncDisposable')[&gt;](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 'System\.Threading\.Tasks\.Task\`1')  
A handle that releases the claim when disposed, or null when someone else holds it \- which
is an ordinary outcome and not a failure\. Releasing is conditional on still holding it, so
a handle disposed after its deadline cannot revoke the claim of whoever took over\.
