Skip to content
Roboto
Esc
↑↓navigate↵open⌘Jpreview
On this page

roboto.domain.triggers.sources

What makes a trigger fire: a platform event subscription or a schedule.

A trigger has exactly one firing source. Both kinds feed the same condition and the same targets, and a target cannot tell which one fired it beyond what the event namespace exposes.

Module Contents

EventSubscription

class roboto.domain.triggers.sources.EventSubscription(/, **data)#View Source

Bases: _SourceBase

Fire when any of the subscribed platform events occurs.

Carries once_per because it only means something here: it names what the event is about that the trigger fires at most once for, and a schedule has no such subject.

Parameters

data Any

Attributes

EventSubscription.events

Event types the trigger subscribes to. At least one; a condition may only reference namespace roots exposed by every subscribed event.

EventSubscription.fires_for()

fires_for(event_type)#View Source

Return whether an event of event_type is one this subscription fires for.

Return type

bool

Attributes

EventSubscription.once_per

What the trigger fires at most once per: the occurrence, or an entity the event names. Must be legal for every subscribed event type.

EventSubscription.type

type Literal[TriggerSourceType] #

Discriminator for TriggerSource.

Schedule

class roboto.domain.triggers.sources.Schedule(/, **data)#View Source

Bases: _SourceBase

Fire on a cron schedule, in UTC.

Each scheduled minute fires the trigger once (once_per='occurrence' over the schedule tick). A missed minute is skipped rather than replayed later, so a delayed schedule never floods targets with backdated firings. Cron expressions are evaluated in UTC; a schedule cannot name a time zone.

Parameters

data Any

Attributes

Schedule.cron

cron str #

A five-field cron expression (minute hour day-of-month month day-of-week), evaluated in UTC — e.g. 0 9 * * 1 for 09:00 UTC every Monday.

Schedule.fires_for()

fires_for(event_type)#View Source

Return whether event_type is the schedule occurrence this source fires for.

Return type

bool

Properties

Schedule.once_per

A schedule always fires once per scheduled minute.

Attributes

Schedule.type

type Literal[TriggerSourceType] #

Discriminator for TriggerSource.

TriggerSource

roboto.domain.triggers.sources.TriggerSource#View Source

A trigger’s firing source, discriminated on type.

TriggerSourceType

class roboto.domain.triggers.sources.TriggerSourceType#View Source

Bases: roboto.compat.StrEnum

Discriminator for TriggerSource.

Attributes

TriggerSourceType.Events

Events = 'events' #

The trigger fires when a subscribed platform event occurs.

TriggerSourceType.Schedule

Schedule = 'schedule' #

The trigger fires on a cron schedule.

Was this page helpful?