processing
state, and then into the completed
or failed
state once handled.count
{ Number readOnly } If recurring, this property will hold the number of times the event was triggered, whether manually or through scheduling.err
{ Any readOnly } A fault that is recorded if the event handler failed for any reason, threw an error, etc.expiresAt
{ Date indexed, removable } If set, the event will not trigger once expired and will eventually be garbage collected and deleted by cortex.if
{ Expression removable } An optional expression that triggers the event if it evaluates to a truey value (!!if()
).key
{ String indexed, unique, removable } An optional unique key up to 512 characters to uniquely identify the event.parent
{ ObjectID readOnly } Set to the _id
of a triggering recurring event.parentKey
{ String readOnly, indexed } Set to the key
of a triggering recurring event.principal
{ ObjectID } An account or service account used as the calling principal. Can be set using keys and email addresses.retention
{ Number = never } The retention policy bits. Only affect non-recurring events and children of recurring events.schedule
{ String } A cron format recurrence schedule. Once set, the state
is set to scheduled
and the start
property is set to the next time in the schedule. Recurring events cannot be changed to non-recurring events and vice versa.start
{ Date = new Date() } The date to trigger the event.started
{ Date readOnly } The date the event processing was started (or last started int he case of a recurring event).state
{ Number indexed, readOnly } The current stateerr
. script
event trigger an @on
runtime event based on the event
and param
properties, mirroring the script.fire()
functionality. The param
value becomes the script.arguments
and is also passed as the first argument to the event handler.event
{ String } The event name that matches a registered runtime event (@on
). param
{ Any } An object passed to the event handler as the first argument. notification
event sends a notification based on the name
, variables
and options
properties, mirroring the require('notifications').send(...)
script functionality.name
{ String } Notification name. Can be null or missing for custom notifications. variables
{ Any } Template variables.options
{ Any } Notification options. driver
event runs a db operation based on the options
and privileged
properties, mirroring the require('db.util').createOperation(options, [options]).execute()
script functionality.deleteMany
, deleteOne
, insertMany
, insertOne
, patchMany
, patchOne
, updateMany
, updateOne
.options
{ Object } Operation options from operation.getOptions()
. privileged
{ Boolean = false } If true, privileged options (those only available in-script)console
event outputs param
as if console.log(param)
were called from a script. Console logging is not available in production environments.param
{ Any } Max 8KB message to be output. schedule
cron - is triggered, it will insert a new event with a pending
state with a start
date set to the current time, and tick up the count
property of the parent.err.events.failed
trigger is called when an event fails. The trigger context
is the event instance, with an additional params
(script.arguments) object containing the err
object.configuration.events.softLimit
( Number = 80,000, readOnly ) The number of pending events that can be inserted before the err.events.softLimitExceeded
trigger is fired. When fired, configuration.events.triggerSoftLimit
is set to false
and will not trigger again until reset.configuration.events.hardLimit
( Number = 100,000, readOnly ) The number of pending events that can be inserted before the err.events.hardLimitExceeded
trigger is fired. When fired, configuration.events.triggerHardLimit
is set to false
and will not trigger again until reset. When this threshold is reached, a cortex.invalidArgument.maxAllowed
Fault is thrown.configuration.events.triggerSoftLimit
( Boolean = true ) Initially true, this is set to false if the soft limit is triggered and a script trigger exists in the environment runtime. The trigger will not fire again until the property is reset to true
. The trigger is always fired inline.configuration.events.triggerHardLimit
( Boolean = true ) Initially true, this is set to false if the hard limit is triggered and a script trigger exists in the environment runtime. The trigger will not fire again until the property is reset to true
. The trigger is always fired inline.