Packages

Library to handle all consuming, producing, and exchanging of RabbitMQ messages via AMQP 0-9-1 protocol. Also enables RPC across independent OTP apps over RabbitMQ queues.

Current section

Files

Jump to
white_rabbit lib white_rabbit RPC message.ex
Raw

lib/white_rabbit/RPC/message.ex

defmodule WhiteRabbit.RPC.Message do
@moduledoc """
RPC message modlue that defines a struct and convert functions.
"""
@enforce_keys [:module, :function, :args, :caller_id]
@derive [Jason.Encoder]
defstruct module: nil, function: nil, args: nil, caller_id: nil
def convert!(data) when is_map(data) do
%__MODULE__{
module: data["module"],
function: data["function"],
args: data["args"],
caller_id: data["caller_id"]
}
end
def convert!(data) do
data
end
end