Class Scheduler
Class that represents a scheduler for events.
Inheritance
Implements
Inherited Members
Namespace: Fibula.Scheduling
Assembly: Fibula.Scheduling.dll
Syntax
public class Scheduler : IScheduler
Constructors
| Improve this Doc View SourceScheduler(ILogger)
Initializes a new instance of the Scheduler class.
Declaration
public Scheduler(ILogger logger)
Parameters
Type | Name | Description |
---|---|---|
Serilog.ILogger | logger | The logger to use. |
Properties
| Improve this Doc View SourceCurrentTime
Gets the current time.
Declaration
public DateTimeOffset CurrentTime { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
Logger
Gets a reference to the logger instance.
Declaration
public ILogger Logger { get; }
Property Value
Type | Description |
---|---|
Serilog.ILogger |
QueueSize
Gets the queue size of the scheduler.
Declaration
public int QueueSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceCancelAllFor(UInt32, Type)
Cancels all the events attributed to a requestor.
Declaration
public void CancelAllFor(uint requestorId, Type specificType = null)
Parameters
Type | Name | Description |
---|---|---|
System.UInt32 | requestorId | The id of the requestor. |
System.Type | specificType | Optional. The type of event to remove. By default, it will remove all. |
CancelEvent(IEvent)
Cancels an event.
Declaration
public bool CancelEvent(IEvent evt)
Parameters
Type | Name | Description |
---|---|---|
IEvent | evt | The event to cancel. |
Returns
Type | Description |
---|---|
System.Boolean | True if the event is cancelled, false otherwise. |
RunAsync(CancellationToken)
Begins the scheduler's processing the queue and firing events.
Declaration
public Task RunAsync(CancellationToken cancellationToken)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | cancellationToken | A token to observe for cancellation. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task | A System.Threading.Tasks.Task representing the asynchronous processing operation. |
ScheduleEvent(IEvent, Nullable<TimeSpan>)
Schedules an event to be fired after the specified delay time.
Declaration
public void ScheduleEvent(IEvent eventToSchedule, TimeSpan? delayTime = default(TimeSpan? ))
Parameters
Type | Name | Description |
---|---|---|
IEvent | eventToSchedule | The event to schedule. |
System.Nullable<System.TimeSpan> | delayTime | Optional. The time delay after which the event should be fired. If left null, the event is scheduled to be fired ASAP. |
Events
| Improve this Doc View SourceEventFired
When an event gets fired by the this scheduler.
Declaration
public event EventFiredDelegate EventFired
Event Type
Type | Description |
---|---|
EventFiredDelegate |