AgendaClient
Hierarchy
↳ Client
Client
↳ AgendaClient
Implements
Index
Constructors
Properties
Accessors
Methods
- connect
- disconnect
- getId
- getInterval
- getSelectableStates
- getState
- hasState
- initialize
- isConnected
- isInOneOfStates
- isInState
- reconnect
- setState
- stop
- validateState
Constructors
constructor
+ new AgendaClient(props?
: Props): AgendaClient
Inherited from Client.constructor
Overrides void
Parameters:
Name | Type |
---|---|
props? | Props |
Returns: AgendaClient
Properties
Readonly
collectionName
• collectionName: string
Readonly
databaseName
• databaseName: string
id
• id: string | Guid
Readonly
mongoClient
• mongoClient: MongoDBClient
Optional
Readonly
options
• options? : Record‹string, any›
state
• state: State
Implementation of Client.state
Static
STATES
▪ STATES: object
Overrides void
Type declaration:
connected: string
constructed: string
disconnected: string
failed: string
initialized: string
paused: string
stopped: string
Accessors
library
• get library(): Agenda
Gets library instance.
Returns: Agenda
Agenda
instance.
Methods
connect
▸ connect(): Promise‹void›
Implementation of Client
Connects to Agenda.
async
throws
{Error}
Thrown if Agenda client can't be instantiated.
Returns: Promise‹void›
disconnect
▸ disconnect(): Promise‹void›
Implementation of Client
Disconnects Agenda client.
async
Returns: Promise‹void›
getId
▸ getId(): string | Guid
Implementation of Client
Overrides void
Returns: string | Guid
getInterval
▸ getInterval(): number | undefined
Returns frequency at which client will query looking for jobs that need to be processed.
Returns: number | undefined
Interval for query frequency as a number
, else undefined
.
getSelectableStates
▸ getSelectableStates(): Record‹string, State›
Implementation of Client
Inherited from StatefulMixin.getSelectableStates
Overrides Task.getSelectableStates
Returns: Record‹string, State›
getState
▸ getState(): State
Implementation of Client
Inherited from StatefulMixin.getState
Returns: State
hasState
▸ hasState(): boolean
Implementation of Client
Inherited from StatefulMixin.hasState
Returns: boolean
initialize
▸ initialize(): Promise‹void›
Implementation of Client
Initializes client.
async
Returns: Promise‹void›
isConnected
▸ isConnected(): boolean
Implementation of Client
Evaluates if client is connected to Agenda.
Returns: boolean
Returns true
if client is connected, else false
.
isInOneOfStates
▸ isInOneOfStates(states
: State | State[]): boolean
Implementation of Client
Inherited from StatefulMixin.isInOneOfStates
Overrides Task.isInOneOfStates
Parameters:
Name | Type |
---|---|
states | State | State[] |
Returns: boolean
isInState
▸ isInState(state
: State | State[]): boolean
Implementation of Client
Inherited from StatefulMixin.isInState
Parameters:
Name | Type |
---|---|
state | State | State[] |
Returns: boolean
reconnect
▸ reconnect(): Promise‹void›
Implementation of Client
Reconnects Agenda.
async
Returns: Promise‹void›
setState
▸ setState(state
: State): void
Implementation of Client
Inherited from StatefulMixin.setState
Parameters:
Name | Type |
---|---|
state | State |
Returns: void
stop
▸ stop(): Promise‹void›
Stops Agenda client.
async
Returns: Promise‹void›
validateState
▸ validateState(stateOrStates
: State | State[], error?
: Error): boolean
Implementation of Client
Inherited from StatefulMixin.validateState
Overrides Task.validateState
Parameters:
Name | Type |
---|---|
stateOrStates | State | State[] |
error? | Error |
Returns: boolean