Chronicle. Oban
(chronicle v0.1.2)
Copy Markdown
Propagates audit context through Oban-compatible job arguments.
This module deliberately has no Oban dependency. Use attach/2 while
building a job and with_context/2 in perform/1.
%{account_id: account.id}
|> Chronicle.Oban.attach()
|> MyWorker.new()
|> Oban.insert()
def perform(job) do
Chronicle.Oban.with_context job do
Chronicle.run "account.reconcile" do
...
end
end
endOnly context values are serialized. A live group is process-local and is never propagated through a durable job.
Summary
Functions
Restores serialized audit context for the duration of a block.
Functions
@spec attach( Ecto.Changeset.t(), keyword() ) :: Ecto.Changeset.t()
@spec attach( map(), keyword() ) :: map()
Restores serialized audit context for the duration of a block.
Takes a do block or a zero-arity function, like Chronicle.transaction/3.