DataWeb
Search Results for

    Show / Hide Table of Contents

    Class JobService

    Represents a service for managing background jobs

    Inheritance
    object
    JobService
    Implements
    IJobService
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: DataWeb.Worker
    Assembly: DataWeb.Core.dll
    Syntax
    public class JobService : IJobService
    Remarks

    Initializes a new instance of the JobService class with a specified job store.

    Constructors

    JobService(IJobStore)

    Represents a service for managing background jobs

    Declaration
    public JobService(IJobStore jobStore)
    Parameters
    Type Name Description
    IJobStore jobStore

    The job store to use for managing jobs.

    Remarks

    Initializes a new instance of the JobService class with a specified job store.

    Methods

    GetJobAsync(string, CancellationToken)

    Gets a background job with the specified unique identifier

    Declaration
    public Task<Job> GetJobAsync(string id, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string id

    The unique identifier of the job to retrieve

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Job>

    An asynchronous operation that retrieves the job with the specified Id

    GetJobLogAsync(string, CancellationToken)

    Gets the text log for a background job with the specified unique identifier

    Declaration
    public Task<string> GetJobLogAsync(string id, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string id

    The unique identifier of the job to retrieve the text log for

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<string>

    An asynchronous operation that retrieves the text log for the job with the specified Id

    GetLatestJobsAsync(string, CancellationToken)

    Gets a collection of the latest background jobs with the specified name

    Declaration
    public Task<IEnumerable<Job>> GetLatestJobsAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    The name of the jobs to retrieve

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<IEnumerable<Job>>

    An asynchronous operation that retrieves the latest jobs with the specified name

    GetWorkingJobAsync(string, CancellationToken)

    Gets the working job with the specified name, if one exists

    Declaration
    public Task<Job> GetWorkingJobAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    The name of the job to retrieve

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Job>

    An asynchronous operation that retrieves the working job with the specified name, or null if no such job exists

    IsWorkingJobAsync(string, CancellationToken)

    Checks whether a working job with the specified name exists

    Declaration
    public Task<bool> IsWorkingJobAsync(string name, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    The name of the job to check for

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<bool>

    An asynchronous operation that returns true if a working job with the specified name exists, false otherwise

    SetJobStatusAsync(string, JobStatus, CancellationToken)

    Sets the status of a background job with the specified unique identifier

    Declaration
    public Task SetJobStatusAsync(string id, JobStatus status, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string id

    The unique identifier of the job to update

    JobStatus status

    The new JobStatus to set for the job

    CancellationToken cancellationToken
    Returns
    Type Description
    Task

    An asynchronous operation that sets the status of the job with the specified Id

    StartNewJobAsync(string, int, int, List<Parameter>, CancellationToken)

    Starts a new background job with the specified name, total units of work, and optional parameters

    Declaration
    public Task<Job> StartNewJobAsync(string name, int total, int startOffset = 0, List<Parameter> parameters = null, CancellationToken cancellationToken = default)
    Parameters
    Type Name Description
    string name

    The name of the job to start

    int total

    The total number of units of work for the job

    int startOffset

    The starting progress offset for the job

    List<Parameter> parameters

    Optional parameters for the job

    CancellationToken cancellationToken
    Returns
    Type Description
    Task<Job>

    An asynchronous operation that starts a new job with the specified parameters and returns the newly created job

    Implements

    IJobService
    In this article
    Back to top Generated by DocFX