Thetype exposes the following members.
Gets a date/time when the current state instance was created.
Gets whether transition to this state should ignore job de-serialization exceptions.
Gets if the current state is a final one.
Gets the unique name of the state.
Gets the human-readable reason of a state transition.
Deleted state is used when you are not interested in a processing of a background job. This state isn't backed by any background process, so when you change a state of the job to the Deleted, only expiration time will be set on a job without any additional processing.
The following example demonstrates how to cancel an enqueued background job. Please note that this job may be processed before you change its state.
This example shows how to create an instance of the ChangeState(String, IState, String) method. Please see BackgroundJob.Delete and BackgroundJobClientExtensions.Delete method overloads for simpler API.class and use the
var client = new BackgroundJobClient(); var jobId = client.Enqueue(() => Console.WriteLine("Hello")); var state = new DeletedState(); client.ChangeState(jobId, state, EnqueuedState.StateName);