Skip to content

JobShardManager Methods

Manages the lifecycle of job shards for a specific silo.

AssignJobShardsAsync(DateTimeOffset, int, CancellationToken)

abstract
public abstract Task<List<IJobShard>> AssignJobShardsAsync(DateTimeOffset maxDueTime, int maxNewClaims, CancellationToken cancellationToken)
Assigns orphaned job shards to this silo.

Parameters

maxDueTimeDateTimeOffset
Maximum due time for shards to consider.
maxNewClaimsint
The maximum number of orphaned shards to claim in this call. Use System.Int32.MaxValue for unlimited. Shards already owned by this silo are always returned regardless of this limit.
cancellationTokenCancellationToken
Cancellation token.

Returns

A list of job shards assigned to this silo.

CreateShardAsync(DateTimeOffset, DateTimeOffset, IDictionary<string, string>, CancellationToken)

abstract
public abstract Task<IJobShard> CreateShardAsync(DateTimeOffset minDueTime, DateTimeOffset maxDueTime, IDictionary<string, string> metadata, CancellationToken cancellationToken)
Creates a new job shard owned by this silo.

Parameters

minDueTimeDateTimeOffset
The minimum due time for jobs in this shard.
maxDueTimeDateTimeOffset
The maximum due time for jobs in this shard.
metadataIDictionary<string, string>
Optional metadata for the shard.
cancellationTokenCancellationToken
Cancellation token.

Returns

The newly created job shard.

UnregisterShardAsync(IJobShard, CancellationToken)

abstract
public abstract Task UnregisterShardAsync(IJobShard shard, CancellationToken cancellationToken)
Unregisters a shard owned by this silo.

Parameters

shardIJobShard
The shard to unregister.
cancellationTokenCancellationToken
Cancellation token.

Returns

A task representing the asynchronous operation.