View Source ExRocketmq.Transport behaviour (lib_oss v0.1.0)

The transport layer of the rocketmq protocol, default implementation is ExRocketmq.Transport.TCP

Summary

Functions

get the info of transport

output a pkt by transport layer

recv a packet from transport layer

start transport module

stop transport module

Types

@type error_t() :: {:error, :timeout | any()}
@type t() :: struct()

Callbacks

@callback info(t()) ::
  {:ok, %{pid: pid(), host: String.t(), port: non_neg_integer()}} | error_t()
@callback new(ExRocketmq.Typespecs.opts()) :: t()
@callback output(transport :: t(), msg :: binary()) :: :ok | error_t()
@callback recv(transport :: t()) :: {:ok, binary()} | error_t()
@callback start(t()) :: {:ok, t()} | error_t()
@callback stop(t()) :: :ok

Functions

@spec info(t()) ::
  {:ok, %{pid: pid(), host: String.t(), port: non_neg_integer()}} | error_t()

get the info of transport

@spec output(t(), binary()) :: :ok | error_t()

output a pkt by transport layer

@spec recv(t()) :: {:ok, binary()} | error_t()

recv a packet from transport layer

@spec start(t()) :: {:ok, t()} | error_t()

start transport module

@spec stop(t()) :: :ok

stop transport module