TaskBunny v0.3.2 TaskBunny.Message View Source

Functions that work on TaskBunny messages.

It’s a semi private module used by Job or Worker. You shouldn’t have to deal with it normally.

However in case you need to encode/decode TaskBunny messages, this module will help.

Link to this section Summary

Functions

Add an error log to message body

Decode message body in JSON to map data

Similar to decode/1 but raises an exception on error

Encode message body in JSON with job and argument

Similar to encode/2 but raises an exception on error

Returns a number of errors occurred for the message

Link to this section Functions

Link to this function add_error_log(message, error) View Source
add_error_log(String.t() | map(), TaskBunny.JobError.t()) :: String.t() | map()

Add an error log to message body.

Link to this function decode(message) View Source
decode(String.t()) :: {:ok, map()} | {:error, any()}

Decode message body in JSON to map data.

Link to this function decode!(message) View Source
decode!(String.t()) :: map()

Similar to decode/1 but raises an exception on error.

Link to this function encode(job, payload) View Source
encode(atom(), any()) :: {:ok, String.t()}

Encode message body in JSON with job and argument.

Link to this function encode!(job, payload) View Source
encode!(atom(), any()) :: String.t()

Similar to encode/2 but raises an exception on error.

Link to this function failed_count(message) View Source
failed_count(String.t() | map()) :: integer()

Returns a number of errors occurred for the message.