# JobShardManager Methods

[Type overview](/orleans/docs/api/csharp/microsoft.orleans.durablejobs/orleans.durablejobs.jobshardmanager/)

## AssignJobShardsAsync(DateTimeOffset, int, CancellationToken) {#assignjobshardsasync-system-datetimeoffset-int-system-threading-cancellationtoke-4e9402e6}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durablejobs/orleans.durablejobs.jobshardmanager/methods/assignjobshardsasync-system-datetimeoffset-int-system-threading-cancellationtoke-4e9402e6/)

```csharp
public abstract Task<List<IJobShard>> AssignJobShardsAsync(DateTimeOffset maxDueTime, int maxNewClaims, CancellationToken cancellationToken)
```

Assigns orphaned job shards to this silo.

### Parameters

- `maxDueTime` (`DateTimeOffset`): Maximum due time for shards to consider.
- `maxNewClaims` (`int`): 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.
- `cancellationToken` (`CancellationToken`): Cancellation token.

### Returns

A list of job shards assigned to this silo.

## CreateShardAsync(DateTimeOffset, DateTimeOffset, IDictionary&lt;string, string&gt;, CancellationToken) {#createshardasync-system-datetimeoffset-system-datetimeoffset-system-collections-7f62cc2e}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durablejobs/orleans.durablejobs.jobshardmanager/methods/createshardasync-system-datetimeoffset-system-datetimeoffset-system-collections-7f62cc2e/)

```csharp
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

- `minDueTime` (`DateTimeOffset`): The minimum due time for jobs in this shard.
- `maxDueTime` (`DateTimeOffset`): The maximum due time for jobs in this shard.
- `metadata` (`IDictionary<string, string>`): Optional metadata for the shard.
- `cancellationToken` (`CancellationToken`): Cancellation token.

### Returns

The newly created job shard.

## UnregisterShardAsync(IJobShard, CancellationToken) {#unregistershardasync-orleans-durablejobs-ijobshard-system-threading-cancellation-3b76d0f4}

[Dedicated page](/orleans/docs/api/csharp/microsoft.orleans.durablejobs/orleans.durablejobs.jobshardmanager/methods/unregistershardasync-orleans-durablejobs-ijobshard-system-threading-cancellation-3b76d0f4/)

```csharp
public abstract Task UnregisterShardAsync(IJobShard shard, CancellationToken cancellationToken)
```

Unregisters a shard owned by this silo.

### Parameters

- `shard` (`IJobShard`): The shard to unregister.
- `cancellationToken` (`CancellationToken`): Cancellation token.

### Returns

A task representing the asynchronous operation.
