NatsEx.Protocol (nats_ex v0.3.0)

Functions to build messages according to Nats protocol

Link to this section Summary

Functions

Makes a subscription message

Makes an unsub message

Parses the info string from info message

Extracts message parameters like subject, reply_to subject, sid, number of bytes of payload

Parses payload from payload message

Link to this section Functions

Link to this function

make_pub_message(subject, reply_to, payload)

Specs

make_pub_message(String.t(), nil | String.t(), String.t()) :: String.t()
make_pub_message(String.t(), nil | String.t(), String.t()) :: String.t()

Makes a publish message

Link to this function

make_sub_message(subject, queue_group, sid)

Makes a subscription message

Link to this function

make_unsub_message(sid, num_of_msgs)

Specs

make_unsub_message(integer(), nil | integer()) :: String.t()

Makes an unsub message

Link to this function

parse_info_mesg(arg)

Specs

parse_info_mesg(String.t()) :: String.t()

Parses the info string from info message

Link to this function

parse_message(msg)

Specs

parse_message(String.t()) ::
  {String.t(), String.t() | nil, String.t(), String.t()}

Extracts message parameters like subject, reply_to subject, sid, number of bytes of payload

Link to this function

parse_payload(payload)

Specs

parse_payload(String.t()) :: String.t()

Parses payload from payload message