Interface IBackgroundTask
Describes a backgroud task that may be queued and run later. All implementations must have a constructor accepting a single argument of type System.Collections.Generic.IDictionary<TKey, TValue> that may be used to re-create the task with the value returned from BackgroundTaskArguments if the task must be queued and run at a later time.
Namespace: Mediachase.Commerce.BackgroundTasks
Assembly: Mediachase.Commerce.dll
Version: 12.17.2Syntax
public interface IBackgroundTask
Properties
BackgroundTaskType
Gets the type of the background task.
Declaration
Type BackgroundTaskType { get; }
Property Value
Type | Description |
---|---|
System.Type |
TaskArguments
Gets the arguments to the background task constructor.
Declaration
IDictionary<string, string> TaskArguments { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
Methods
Execute(Action<IBackgroundTaskMessage>, CancellationToken)
Executes the background task.
Declaration
bool Execute(Action<IBackgroundTaskMessage> addMessage, CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Action<IBackgroundTaskMessage> | addMessage | A delegate to add messages as the task runs. |
System.Threading.CancellationToken | cancellationToken | A cancellation token that the task manager may use to attempt to cancel a running task. Tasks that ignore the cancellation may be forcibly terminated. |
Returns
Type | Description |
---|---|
System.Boolean | True if the task succeeded, false if it failed. |