#Is it possible to have a job that is triggered by multiple event names?

1 messages · Page 1 of 1 (latest)

vast coral
#

I need to do some computations which are based on somewhat generic events. Unfortunately, it seems like the API only allows a job to be triggered by a single event.

It would probably also be nice if a job could be triggered by multiple trigger types (e.g. both events as well as a cron). Is the current guidance to make a job for each trigger and share the run function between the Jobs?

vast coral
#

I see that part of the difficulty is that the payload schema is specified on the event trigger. I think this is overcomable, though, by taking an array of triggers and unioning their payload schemas.

#

Also, it seems strange that I need a invokeTrigger() to be able to manually invoke my job. Shouldn't I just be able to manually invoke any job?

modest cedar
#

You’re correct that the reason we don’t allow multiple triggers on a job is because of the payloads. You can get into weird situations where they have the same key with different types…

#

We recommend creating multiple jobs and then just invoking or sending event to trigger the common job that does the work and has the shared schema.