Interface IJobTracker<TCommand>
the interface defining a job tracker
Namespace: FastEndpoints
Assembly: FastEndpoints.dll
Syntax
public interface IJobTracker<TCommand> where TCommand : ICommandBase
Type Parameters
Name | Description |
---|---|
TCommand | the command type of the job |
Methods
CancelJobAsync(Guid, CancellationToken)
cancel a job by its tracking id. if the job is currently executing, the cancellation token passed down to the command handler method will be notified of the cancellation. the job storage record will also be marked complete via CancelJobAsync(Guid, CancellationToken) method of the job storage provider, which will prevent the job from being picked up for execution.
Declaration
Task CancelJobAsync(Guid trackingId, CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
Guid | trackingId | the job tracking id |
CancellationToken | ct | optional cancellation token |
Returns
Type | Description |
---|---|
Task |
Exceptions
Type | Condition |
---|---|
Exception | this method will throw any exceptions that the job storage provider may throw in case of transient errors. you can safely retry calling this method repeatedly with the same tracking id. |
GetJobResultAsync<TResult>(Guid, CancellationToken)
retrieve the result of a command (that returns a result) which was previously queued as a job. the returned result will be null/default until the job is actually complete.
Declaration
Task<TResult?> GetJobResultAsync<TResult>(Guid trackingId, CancellationToken ct = default)
Parameters
Type | Name | Description |
---|---|---|
Guid | trackingId | the job tracking id |
CancellationToken | ct | cancellation token |
Returns
Type | Description |
---|---|
Task<TResult> |
Type Parameters
Name | Description |
---|---|
TResult | the type of the expected result |