-
Notifications
You must be signed in to change notification settings - Fork 232
Ent Batches
Faktory Enterprise allows the developer to declare a set of jobs to perform as a group and fire a callback when all of those jobs are complete or successful. This is known as a batch of jobs.
Use the BATCH command to start a batch with a JSON blob that represents either/both a success or complete callback job. Each batch has a unique BID to identify it.
bid = BATCH {"description":"An optional description for the Web UI",
"success":{"jobtype":"MySuccessCallback","args":[user_id],"queue":"critical"},
"complete":...}
jid = PUSH ...
jid = PUSH ...
COMMIT
Although this simple example doesn't show it, you may nest batches arbitrarily deep. The initial batch data has a TTL of 30 minutes and will expire if your code does not call COMMIT. Each job you push will have the Batch BID placed into its "custom" data hash.
You can dynamically add more jobs or nested, child batches to a batch by reopening it:
BATCH bid
jid = PUSH ...
childbid = BATCH ...
childjid = PUSH ...
COMMIT
COMMIT
The initial batch creation must include a success and/or a complete job callback. A callback is job that Faktory will enqueue once the batch of jobs has completed or succeeded.
You can retrieve the status of a batch using the BSTATUS command. This returns a JSON blob of data associated with the batch:
BSTATUS bid
{"bid":<bid>,"total":17,"pending":14,"failed":3","created_at":"2019-11-18T13:48:25Z","description":"..."}
Home | Installation | Getting Started Ruby | Job Errors | FAQ | Related Projects
This wiki is tracked by git and publicly editable. You are welcome to fix errors and typos. Any defacing or vandalism of content will result in your changes being reverted and you being blocked.