Bedrock.JobQueue.Payload (bedrock_job_queue v0.2.0)
View SourcePayload encoding and decoding for job queue items.
Payloads are stored as JSON-encoded binaries. Binary payloads are passed through unchanged for efficiency (assumed to already be encoded).
Summary
Functions
Decodes a stored payload for job execution.
Attempts JSON decode with atom keys. If decode fails (e.g., binary wasn't JSON), wraps the raw binary in a map for the job to handle.
Safety Note
Uses keys: :atoms! which only converts keys to atoms if they already exist in
the atom table. This prevents atom exhaustion from untrusted JSON payloads.
Unknown keys will cause a decode error, falling back to %{raw: payload}.
Encodes a payload for storage.
Binary payloads are passed through unchanged. Other payloads are JSON encoded.