JoobQ.Context (joobq_ex v0.8.0)

Copy Markdown View Source

The request context of the job a handler runs, carried on to the work it starts. Inside perform/1 (and its middleware), JoobQ.enqueue/4, enqueue_async/4, enqueue_many/2, create_batch/2 and start_workflow/3 lay the running job's context (job.context: tenant_id, request_id, traceparent, ...) under the context you give them, whose keys win, as every SDK's ctx.enqueue, ctx.start and ctx.create_batch do. Keys are strings (an atom key is turned into its string).

It lives in the handler's own process: a process it starts has none, so pass context: job.context there.

Summary

Functions

The context of the job this process runs, %{} outside a handler.

own laid over base, both with string keys. An own that is not a map, or a struct on either side, is answered as it is, never walked: it goes on to the body, which the gateway's JSON encoding refuses by its kind only.

Functions

current()

@spec current() :: map()

The context of the job this process runs, %{} outside a handler.

merge(base, own)

@spec merge(term(), term()) :: term()

own laid over base, both with string keys. An own that is not a map, or a struct on either side, is answered as it is, never walked: it goes on to the body, which the gateway's JSON encoding refuses by its kind only.