TaskBunny v0.1.2 TaskBunny.Message

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.

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

Functions

add_error_log(message, error)
add_error_log(String.t | map, any) :: String.t | map

Add an error log to message body.

decode(message)
decode(String.t) :: {:ok, map} | {:error, any}

Decode message body in JSON to map data.

decode!(message)
decode!(String.t) :: map

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

encode(job, payload)
encode(atom, any) :: {:ok, String.t}

Encode message body in JSON with job and argument.

encode!(job, payload)
encode!(atom, any) :: String.t

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

failed_count(message)
failed_count(String.t | map) :: integer

Returns a number of errors occurred for the message.