Safe Haskell | Safe-Inferred |
---|---|
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
- newtype BatchId = BatchId Text
- newtype CustomBatchId = CustomBatchId {}
- newBatch :: ToJSON arg => Producer -> BatchOptions arg -> IO BatchId
- commitBatch :: Producer -> BatchId -> IO ()
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 #
Low-level
newtype CustomBatchId Source #
Instances
ToJSON CustomBatchId Source # | |
Defined in Faktory.Ent.Batch toJSON :: CustomBatchId -> Value # toEncoding :: CustomBatchId -> Encoding # toJSONList :: [CustomBatchId] -> Value # toEncodingList :: [CustomBatchId] -> Encoding # omitField :: CustomBatchId -> Bool # | |
Generic CustomBatchId Source # | |
Defined in Faktory.Ent.Batch type Rep CustomBatchId :: Type -> Type # from :: CustomBatchId -> Rep CustomBatchId x # to :: Rep CustomBatchId x -> CustomBatchId # | |
type Rep CustomBatchId Source # | |
Defined in Faktory.Ent.Batch type Rep CustomBatchId = D1 ('MetaData "CustomBatchId" "Faktory.Ent.Batch" "faktory-1.1.2.7-2ueK9WlYC3nL6yjpm69v98" 'True) (C1 ('MetaCons "CustomBatchId" 'PrefixI 'True) (S1 ('MetaSel ('Just "bid") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 BatchId))) |