Interface IScheduler
Interface that represents a scheduler.
Namespace: Fibula.Scheduling.Contracts.Abstractions
Assembly: Fibula.Scheduling.Contracts.dll
Syntax
public interface IScheduler
Properties
| Improve this Doc View SourceCurrentTime
Gets the current time.
Declaration
DateTimeOffset CurrentTime { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
QueueSize
Gets the queue size of the scheduler.
Declaration
int QueueSize { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Methods
| Improve this Doc View SourceCalculateTimeToFire(IEvent)
Calculates the time left to fire a given event.
Declaration
TimeSpan CalculateTimeToFire(IEvent evt)
Parameters
Type | Name | Description |
---|---|---|
IEvent | evt | The event to calculate against. |
Returns
Type | Description |
---|---|
System.TimeSpan | A System.TimeSpan representing the time left to fire, or System.TimeSpan.Zero. |
CancelAllFor(UInt32, Type)
Cancels all events attributed to the specified requestor.
Declaration
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
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
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>, Boolean)
Schedules an event to be fired at the specified time.
Declaration
void ScheduleEvent(IEvent eventToSchedule, TimeSpan? delayTime = default(TimeSpan? ), bool scheduleAsync = false)
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. |
System.Boolean | scheduleAsync | Optional. A value indicating whether to schedule asynchronously or not. |
Events
| Improve this Doc View SourceEventFired
Event fired when an event gets fired by the scheduler.
Declaration
event EventFiredDelegate EventFired
Event Type
Type | Description |
---|---|
EventFiredDelegate |