View Source ExRocketmq.Remote (lib_oss v0.1.0)

The remote layer of the rocketmq: how client communicates with the nameserver or broker. Remote support 3 functions:

  • rpc: request-reply
  • one_way: send msg and don't wait for the response
  • pop_notify: pop the notify msg from the queue

Summary

Functions

Returns a specification to start this module under a supervisor.

Callback implementation for GenServer.init/1.

send msg to the remote server, and don't wait for the response

make a rpc call to the remote server, and return the response

stop remote server

get transport running info

Types

Link to this type

remote_opts_schema_t()

View Source
@type remote_opts_schema_t() :: [
  transport: term(),
  serializer: term(),
  opts: keyword()
]

Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

handle_continue(atom, state)

View Source

Callback implementation for GenServer.handle_continue/2.

Callback implementation for GenServer.init/1.

@spec one_way(pid(), ExRocketmq.Remote.Packet.t()) :: :ok

send msg to the remote server, and don't wait for the response

Examples

iex> :ok = ExRocketmq.Remote.one_way(remote, msg)
@spec pop_notify(pid()) :: ExRocketmq.Remote.Packet.t() | :empty
Link to this function

rpc(remote, pkt, timeout \\ 30000)

View Source
@spec rpc(pid(), ExRocketmq.Remote.Packet.t(), non_neg_integer()) ::
  {:ok, ExRocketmq.Remote.Packet.t()} | {:error, any()}

make a rpc call to the remote server, and return the response

Examples

iex> {:ok, _res} = ExRocketmq.Remote.rpc(remote, msg)
@spec stop(pid()) :: :ok

stop remote server

@spec transport_info(pid()) :: {:ok, map()} | {:error, any()}

get transport running info

Examples

iex> ExRocketmq.Remote.transport_info(remote)
{:ok, %{host: "some host", port: 1234, pid: #PID<0.123.0>}}