Search Results for

    Show / Hide Table of Contents

    Class JobQueueExtensions

    extension methods for job queues

    Inheritance
    object
    JobQueueExtensions
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    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 : class, 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

    CreateJob<TStorageRecord>(ICommandBase, DateTime?, DateTime?)

    creates a new job object for the provided command.

    Declaration
    public static TStorageRecord CreateJob<TStorageRecord>(this ICommandBase cmd, DateTime? executeAfter = null, DateTime? expireOn = null) where TStorageRecord : class, IJobStorageRecord, new()
    Parameters
    Type Name Description
    ICommandBase cmd

    the command to be set in the job

    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.

    Returns
    Type Description
    TStorageRecord

    the new job object

    Type Parameters
    Name Description
    TStorageRecord

    the type of your IJobStorageRecord concrete class

    Exceptions
    Type Condition
    ArgumentException

    thrown if the executeAfter and expireOn arguments are not UTC values

    QueueJobAsync(ICommandBase, DateTime?, DateTime?, CancellationToken)

    queues up a given command in the respective job queue for that command type.

    Declaration
    public static Task<Guid> QueueJobAsync(this ICommandBase cmd, DateTime? executeAfter = null, DateTime? expireOn = null, CancellationToken ct = default)
    Parameters
    Type Name Description
    ICommandBase 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<Guid>
    Exceptions
    Type Condition
    ArgumentException

    thrown if the executeAfter and expireOn arguments are not UTC values

    TriggerJobExecution(ICommandBase)

    triggers the execution of jobs in the respective queue for that command type.

    Declaration
    public static void TriggerJobExecution(this ICommandBase cmd)
    Parameters
    Type Name Description
    ICommandBase cmd

    the command used to determine which queue to trigger

    TriggerJobExecution<TCommand>()

    triggers the execution of jobs in the respective queue for that command type.

    Declaration
    public static void TriggerJobExecution<TCommand>() where TCommand : ICommandBase
    Type Parameters
    Name Description
    TCommand

    the command type used to determine which queue to trigger

    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

    In this article
    Back to top Developed by Đĵ ΝιΓΞΗΛψΚ and contributors / Licensed under MIT / Website generated by DocFX