Class JobQueueExtensions
extension methods for job queues
Inherited Members
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public static class JobQueueExtensions
Methods
AddJobQueues<TStorageRecord, TStorageProvider>(IServiceCollection)
add job queue functionality
Declaration
public static IServiceCollection AddJobQueues<TStorageRecord, TStorageProvider>(this IServiceCollection svc) where TStorageRecord : IJobStorageRecord, new() where TStorageProvider : class, IJobStorageProvider<TStorageRecord>
Parameters
Type | Name | Description |
---|---|---|
IServiceCollection | svc |
Returns
Type | Description |
---|---|
IServiceCollection |
Type Parameters
Name | Description |
---|---|
TStorageRecord | the implementation type of the job storage record |
TStorageProvider | the implementation type of the job storage provider |
QueueJobAsync(ICommand, DateTime?, DateTime?, CancellationToken)
queues up a given command in the respective job queue for that command type.
Declaration
public static Task QueueJobAsync(this ICommand cmd, DateTime? executeAfter = null, DateTime? expireOn = null, CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
ICommand | cmd | the command to be queued |
DateTime? | executeAfter | if set, the job won't be executed before this date/time. if unspecified, execution is attempted as soon as possible. |
DateTime? | expireOn | if set, job will be considered stale/expired after this date/time. if unspecified, jobs expire after 4 hours of creation. |
CancellationToken | ct | cancellation token |
Returns
Type | Description |
---|---|
Task |
UseJobQueues(IApplicationBuilder, Action<JobQueueOptions>?)
enable job queue functionality with given settings
Declaration
public static IApplicationBuilder UseJobQueues(this IApplicationBuilder app, Action<JobQueueOptions>? options = null)
Parameters
Type | Name | Description |
---|---|---|
IApplicationBuilder | app | |
Action<JobQueueOptions> | options | specify settings/execution limits for each job queue type |
Returns
Type | Description |
---|---|
IApplicationBuilder |
Exceptions
Type | Condition |
---|---|
InvalidOperationException | thrown when no commands/handlers have been detected |