retort v1.2.0 Retort.Server.Generic.Resources

Exposes an Ecto.Schema.t as a JSONAPI resource over JSON RPC on a RabbitMQ queue.

Any code with side-effects, such as Logger or Repo calls should stay in this module. Any pure functions that write back to the Retort.Server.Generic.RPC.t can be in Retort.Server.Generic.RPC.

Summary

Types

t()
  • calcinator - the state of Calcinator
  • changeset_render - render changeset that has errors

Functions

Should match on rpc.decoded.method and return rpc with rpc.response.decoded.result set

Sets connection, channel, and queue to Rabbit

Types

t()
t() :: %Retort.Server.Generic.Resources{calcinator: Calcinator.t, changeset_render: (Ecto.Changeset.t -> map)}
  • calcinator - the state of Calcinator
  • changeset_render - render changeset that has errors

Functions

handle_method(r_p_c, arg2)
handle_method(%Retort.Server.Generic.RPC{assigns: term, halted: true, meta: term, request: term, response: term, timing: term} | %Retort.Server.Generic.RPC{assigns: term, halted: false, meta: term, request: %{decoded: %Retort.Request{id: term, jsonrpc: term, method: binary, params: map}}, response: term, timing: term}, t) :: Retort.Server.Generic.RPC.t

Should match on rpc.decoded.method and return rpc with rpc.response.decoded.result set.

Callback implementation for Retort.Server.Generic.handle_method/2.

init(generic, resources)
init(Retort.Server.Generic.t, t) :: {:ok, t}

Sets connection, channel, and queue to Rabbit