AgendaCommandScheduler

Hierarchy

Implements

Index

Constructors

Properties

Methods

Object literals

Constructors

constructor

+ new AgendaCommandScheduler(jobName?: string, options?: AgendaConfiguration): AgendaCommandScheduler

Creates an instance of AgendaCommandScheduler. Creates an instance of AgendaCommandScheduler.

Parameters:

NameTypeDescription
jobName?stringName of the job that is being scheduled on Agenda.
options?AgendaConfigurationOptional options passed to Agenda client.

Returns: AgendaCommandScheduler

Properties

Readonly agendaClient

agendaClient: AgendaClient


Readonly jobName

jobName: string


Optional Readonly options

options? : AgendaConfiguration


state

state: State

Implementation of CommandScheduler.state

Overrides StatefulMixin.state

Methods

getInterval

getInterval(): number

Implementation of CommandScheduler

Returns frequency at which schedule will query looking for scheduled commands that need to be processed.

Returns: number

Interval for query frequency as a number, else undefined.


getJob

getJob(commandType: string, assignerId: string | Guid, assignerType: string, assignmentId?: string | Guid): Promise‹ScheduledJob | undefined›

Implementation of CommandScheduler

Returns ScheduledJob if it can be found on Scheduler.

Parameters:

NameTypeDescription
commandTypestringCommand type name for which schedule was made.
assignerIdstring | GuidSource of scheduled job i.e. Event Sourceable's identifier.
assignerTypestringEvent Sourceable type name.
assignmentId?string | GuidAssignment identifier.

Returns: Promise‹ScheduledJob | undefined›

Instance implementing ScheduledJob interface, else undefined.


getSelectableStates

getSelectableStates(): Record‹string, State

Implementation of CommandScheduler

Inherited from StatefulMixin.getSelectableStates

Overrides Task.getSelectableStates

Returns: Record‹string, State


getState

getState(): State

Implementation of CommandScheduler

Inherited from StatefulMixin.getState

Overrides Task.getState

Returns: State


handleScheduledCommand

handleScheduledCommand(job: Agenda.Job): Promise‹void›

Agenda job handler for ScheduledCommand.

async

Parameters:

NameTypeDescription
jobAgenda.JobInstance implementing Agenda.Job interface.

Returns: Promise‹void›


hasState

hasState(): boolean

Implementation of CommandScheduler

Inherited from StatefulMixin.hasState

Overrides Task.hasState

Returns: boolean


initialize

initialize(): Promise‹void›

Implementation of CommandScheduler

Initializes Agenda command scheduler.

async

throws {InactiveClientError} Thrown if agenda client is not connected.

Returns: Promise‹void›


isInOneOfStates

isInOneOfStates(states: State | State[]): boolean

Implementation of CommandScheduler

Inherited from StatefulMixin.isInOneOfStates

Overrides Task.isInOneOfStates

Parameters:

NameType
statesState | State[]

Returns: boolean


isInState

isInState(state: State | State[]): boolean

Implementation of CommandScheduler

Inherited from StatefulMixin.isInState

Overrides Task.isInState

Parameters:

NameType
stateState | State[]

Returns: boolean


schedule

schedule(scheduleCommand: ScheduleCommand): Promise‹void›

Implementation of CommandScheduler

Schedules command with Agenda.

async

throws {CommandSchedulingError} Thrown if scheduled command cannot be scheduled.

Parameters:

NameTypeDescription
scheduleCommandScheduleCommandInstance of ScheduleCommand.

Returns: Promise‹void›


setState

setState(state: State): void

Implementation of CommandScheduler

Inherited from StatefulMixin.setState

Overrides Task.setState

Parameters:

NameType
stateState

Returns: void


startScheduling

startScheduling(): Promise‹void›

Implementation of CommandScheduler

Starts processing on CommandScheduler.

Returns: Promise‹void›


stopScheduling

stopScheduling(): Promise‹void›

Implementation of CommandScheduler

Stops processing on CommandScheduler.

Returns: Promise‹void›


unschedule

unschedule(unscheduleCommand: UnscheduleCommand): Promise‹boolean›

Implementation of CommandScheduler

Unschedules command from Agenda.

async

throws {CommandUnschedulingError} Thrown if scheduled command cannot be canceled.

Parameters:

NameTypeDescription
unscheduleCommandUnscheduleCommandInstance of UnscheduleCommand.

Returns: Promise‹boolean›


unscheduleAll

unscheduleAll(): Promise‹void›

Implementation of CommandScheduler

Unschedules all commands(jobs matching scheduler's job name) from Agenda.

async

Returns: Promise‹void›


validateState

validateState(stateOrStates: State | State[], error?: Error): boolean

Implementation of CommandScheduler

Inherited from StatefulMixin.validateState

Overrides Task.validateState

Parameters:

NameType
stateOrStatesState | State[]
error?Error

Returns: boolean

Object literals

Static STATES

STATES: object

active

active: string = "active"

constructed

constructed: string = "constructed"

initialized

initialized: string = "initialized"

stopped

stopped: string = "stopped"