Safe Haskell | None |
---|---|
Language | Haskell2010 |
Support for the BATCH
command (Enterprise only)
https://github.com/contribsys/faktory/wiki/Ent-Batches
Batches allow multiple Jobs to be enqueued as a group, with a description (visible in the admin UI) and Jobs attached to run on completion of all Jobs within the group (always, or only if all were successful).
Usage:
-- Build a Job to run at completion of the Batch. Arguments are the same as -- you would pass toperform
the Job. onComplete <- buildJob mempty producer myJobrunBatch
(complete
onComplete <>description
"My Batch") producer $ do -- UsebatchPerform
instead ofperform
void $batchPerform
mempty producer myBatchedJob1 void $batchPerform
mempty producer myBatchedJob2
/NOTE: This module does not support batched Jobs dynamically adding more Jobs to the Batch. PRs welcome.
Synopsis
- data BatchOptions arg
- description :: Text -> BatchOptions arg
- complete :: Job arg -> BatchOptions arg
- success :: Job arg -> BatchOptions arg
- runBatch :: ToJSON arg => BatchOptions arg -> Producer -> Batch a -> IO a
- data Batch a
- batchPerform :: (HasCallStack, ToJSON arg) => JobOptions -> Producer -> arg -> Batch JobId
Options
data BatchOptions arg Source #
Instances
description :: Text -> BatchOptions arg Source #
complete :: Job arg -> BatchOptions arg Source #
success :: Job arg -> BatchOptions arg Source #
Running
batchPerform :: (HasCallStack, ToJSON arg) => JobOptions -> Producer -> arg -> Batch JobId Source #