Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Job Results

transactionalWorkerConfig stores a handler's return value. Manual and batched handlers pass results to ackWith or ackAllWith.

JobWhere the result goes
Has a parentStored for the parent. Deleted when the parent completes.
Root, archiving onStored in the archive entry.
Root, archiving offDiscarded.

Result types need ToJSON and FromJSON.

A parent reads its children with one of:

FunctionReturns
Worker.childResultsA map of one Either per child, and a map of the DLQ failures.
Worker.mergedChildResultsThe Monoid sum of the results and the DLQ failures. A result that fails to decode counts as mempty.

Nothing in a Maybe result stores nothing:

data SyncReport = SyncReport
  { rowsChanged :: Int
  , notes :: [Text]
  }
  deriving stock (Eq, Show, Generic)
  deriving anyclass (ToJSON, FromJSON)

type SyncRegistry = '[ QueueWithResult "sync_queue" SyncPayload (Maybe SyncReport) ]

syncHandler :: Arb.JobHandler (ArbS.SimpleDb SyncRegistry IO) SyncPayload (Maybe SyncReport)
syncHandler _conn job = do
  report <- runSync (Arb.payload job)
  pure $ if rowsChanged report == 0 then Nothing else Just report

Result encoding: Arbiter.Core.JobResult Haddocks.