Click or drag to resize
ScheduledState Class
Defines the intermediate state of a background job when it is placed on a schedule to be moved to the EnqueuedState in the future by DelayedJobScheduler background process.
Inheritance Hierarchy
SystemObject
  Hangfire.StatesScheduledState

Namespace: Hangfire.States
Assembly: Hangfire.Core (in Hangfire.Core.dll) Version: 1.5.0.0
Syntax
public class ScheduledState : IState

The ScheduledState type exposes the following members.

Constructors
  NameDescription
Public methodScheduledState(DateTime)
Initializes a new instance of the ScheduledState class with the specified date/time in UTC format when a job should be moved to the EnqueuedState.
Public methodScheduledState(TimeSpan)
Initializes a new instance of the ScheduledState class with the specified time interval after which a job should be moved to the EnqueuedState.
Top
Properties
  NameDescription
Public propertyEnqueueAt
Gets a date/time when a background job should be enqueued.
Public propertyIgnoreJobLoadException
Gets whether transition to this state should ignore job de-serialization exceptions.
Public propertyIsFinal
Gets if the current state is a final one.
Public propertyName
Gets the unique name of the state.
Public propertyReason
Gets the human-readable reason of a state transition.
Public propertyScheduledAt
Gets a date/time when the current state instance was created.
Top
Methods
  NameDescription
Public methodSerializeData
Gets a serialized representation of the current state.
Top
Fields
  NameDescription
Public fieldStatic memberStateName
Represents the name of the Scheduled state. This field is read-only.
Top
Remarks

Background job in ScheduledState is referred as delayed job.

Examples
The following example demonstrates the creation of a background job that will be processed after two hours. Please see BackgroundJob.Schedule and BackgroundJobClientExtensions.Schedule method overloads for simpler API.
C#
var client = new BackgroundJobClient();
var state = new ScheduledState(TimeSpan.FromHours(2));

client.Create(() => Console.WriteLine("Hello!"), state);
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
See Also