Elixir API for OMQ.
OMQ sockets are ZeroMQ-compatible message queues backed by the Rust
omq-tokio runtime. Create a context with context/0 or reuse the
process-wide singleton with context_instance/0, then create sockets with
socket/2.
Endpoints are binaries or strings such as "tcp://127.0.0.1:5555",
"ipc:///tmp/omq.sock", "inproc://queue", "lz4+tcp://127.0.0.1:5555",
and "zstd+tcp://127.0.0.1:5555".
Functions return Erlang result shapes unchanged: :ok, {:ok, value},
{:ok, value, metadata} where documented by Erlang, or
{:error, class, reason}.
send/3 accepts either an integer flags mask or an option list. Supported
options are :sndmore, :noblock, :dontwait, {:flags, flags}, and
{:routing_id, id}. recv/1 and recv/2 return either {:ok, data} or
routing metadata maps for ROUTER/SERVER-style sockets.
Summary
Types
Native OMQ context resource.
Endpoint URI accepted by bind/connect.
Socket monitor event stream resource.
Common OMQ result shape.
Send flags or option list.
Native OMQ socket resource.
Functions
AFFINITY option ID.
Return native backend name.
BACKLOG option ID.
Bind socket to endpoint and return bound endpoint.
Bind socket to random ephemeral port on address.
Bind socket to random port in inclusive range.
CHANNEL socket type constant.
CLIENT socket type constant.
Close socket with zero linger.
Close socket with explicit linger in milliseconds.
Return whether socket wrapper is closed.
CONFLATE option ID.
Connect socket to endpoint.
CONNECT_TIMEOUT option ID.
Return one connection snapshot by ID.
Return current connection snapshots for socket.
Create a context with one IO thread.
Create a context with requested native IO thread count.
Return whether this context wrapper or native core is closed.
Import native context by share key without owning its runtime.
Return process-wide singleton context.
Return process-wide singleton context, creating it with IO thread count.
Return opaque native context share key.
CURVE mechanism constant.
Generate CURVE public/secret keypair.
Derive CURVE public key from secret key.
CURVE_PUBLICKEY option ID.
CURVE_SECRETKEY option ID.
CURVE_SERVER option ID.
CURVE_SERVERKEY option ID.
DEALER socket type constant.
Terminate a context. Alias for term/1.
Run libzmq-compatible device. Device type is accepted for parity.
Disconnect socket from endpoint.
DISH socket type constant.
DONTWAIT alias for NOBLOCK.
EVENTS option ID.
FD option ID.
FORWARDER device type constant.
Import native context by share key.
GATHER socket type constant.
Get socket option. Alias for getsockopt/2.
Return SNDHWM as compatibility HWM value.
Get socket option by atom or integer option ID.
Get binary socket option as UTF-8 text.
HANDSHAKE_IVL option ID.
Return whether native feature or transport is available.
HEARTBEAT_IVL option ID.
HEARTBEAT_TIMEOUT option ID.
HEARTBEAT_TTL option ID.
HWM compatibility option ID.
IDENTITY option ID.
IMMEDIATE option ID.
Return process-wide singleton context.
Return process-wide singleton context, creating it with IO thread count.
IPV4ONLY option ID.
IPV6 option ID.
Join RADIO/DISH group.
LAST_ENDPOINT option ID.
Leave RADIO/DISH group.
LINGER option ID.
MAXMSGSIZE option ID.
MECHANISM option ID.
Create monitor stream for socket lifecycle events.
Receive next monitor event.
Receive next monitor event with timeout in milliseconds.
Try to receive one monitor event without blocking.
MULTICAST_HOPS option ID.
NOBLOCK send/receive flag.
NULL mechanism constant.
OMQ_COMPRESSION_AUTO_TRAIN option ID.
OMQ_COMPRESSION_DICT option ID.
OMQ_COMPRESSION_LEVEL option ID.
OMQ_ON_MUTE option ID.
OMQ_ON_MUTE block mode value.
OMQ_ON_MUTE drop-newest mode value.
OMQ_ON_MUTE drop-oldest mode value.
Return native binding version. Alias for version/0.
Return native binding version as {major, minor, patch}.
OMQ_WORKLOAD_PROFILE option ID.
PAIR socket type constant.
PEER socket type constant.
PLAIN mechanism constant.
PLAIN_PASSWORD option ID.
PLAIN_SERVER option ID.
Configures an exact, case-sensitive PLAIN server credential allowlist.
Configures a PLAIN server accepting one fixed credential pair.
PLAIN_USERNAME option ID.
Poll socket readiness entries with timeout in milliseconds.
POLLERR readiness flag.
POLLIN readiness flag.
POLLOUT readiness flag.
POLLPRI readiness flag.
PROBE_ROUTER option ID.
Run bidirectional proxy between two sockets.
Run bidirectional proxy and mirror traffic to capture socket.
Run steerable proxy with PAUSE, RESUME, and TERMINATE control.
PUB socket type constant.
PULL socket type constant.
PUSH socket type constant.
QUEUE device type constant.
RADIO socket type constant.
RATE option ID.
RCVBUF option ID.
RCVHWM option ID.
RCVMORE option ID.
RCVTIMEO option ID.
RECONNECT_IVL option ID.
RECONNECT_IVL_MAX option ID.
RECONNECT_STOP option ID.
RECOVERY_IVL option ID.
Receive one message using socket timeout options.
Receive one message with timeout in milliseconds.
Receive next frame from multipart message.
Receive next frame with timeout in milliseconds.
Receive one JSON value decoded by OTP json.
Receive one JSON value with timeout in milliseconds.
Receive one multipart message using socket timeout options.
Receive one multipart message with timeout in milliseconds.
Receive one UTF-8 string message.
Receive one string with timeout or wire encoding.
Receive one string with timeout and wire encoding.
Receive one Erlang term encoded by send_term/2,3.
Receive one Erlang term with timeout in milliseconds.
REP socket type constant.
REQ socket type constant.
REQ_CORRELATE option ID.
REQ_RELAXED option ID.
ROUTER socket type constant.
ROUTER_HANDOVER option ID.
ROUTER_MANDATORY option ID.
ROUTING_ID option ID.
SCATTER socket type constant.
Return ready read, write, and exception socket lists.
Send one binary message.
Send one binary message with flags or options.
Send RADIO message to group.
Send one JSON value encoded by OTP json.
Send one JSON value with flags or options.
Send one multipart message.
Send one multipart message with flags or options.
Send one UTF-8 string message.
Send string with options or source encoding.
Send string using requested wire encoding and options.
Send one Erlang term using external term format.
Send one Erlang term with flags or options.
SERVER socket type constant.
Set socket option. Alias for setsockopt/3.
Set both SNDHWM and RCVHWM.
Set socket option by atom or integer option ID.
Set binary socket option from UTF-8 text.
Return opaque native context share key.
SNDBUF option ID.
SNDHWM option ID.
SNDMORE send flag.
SNDTIMEO option ID.
Create socket from context and socket type.
Return wrapper socket ID.
Return socket type atom.
STREAM socket type constant.
STREAMER device type constant.
Return POSIX strerror text for common libzmq errno values.
SUB socket type constant.
Subscribe SUB or XSUB socket to prefix.
SUBSCRIBE option ID.
TCP_ACCEPT_FILTER option ID.
TCP_KEEPALIVE option ID.
TCP_KEEPALIVE_CNT option ID.
TCP_KEEPALIVE_IDLE option ID.
TCP_KEEPALIVE_INTVL option ID.
TCP_MAXRT option ID.
Terminate a context.
Try to receive one message without blocking.
Try to receive one JSON value without blocking.
Try to receive one multipart message without blocking.
Try to receive one UTF-8 string without blocking.
Try to receive one string with wire encoding.
Try to receive one Erlang term without blocking.
Try to send one binary message without blocking.
Try to send one binary message with flags or options.
TYPE option ID.
Unbind socket from endpoint.
Remove SUB or XSUB prefix subscription.
UNSUBSCRIBE option ID.
Return native binding version.
Wait until at least min_peers peers are connected.
Wait until at least min_subscriptions subscriptions are visible.
XPUB socket type constant.
XPUB_VERBOSE option ID.
XSUB socket type constant.
ZAP_DOMAIN option ID.
Return libzmq compatibility version string.
Return libzmq compatibility version tuple.
Types
@type context() :: term()
Native OMQ context resource.
Endpoint URI accepted by bind/connect.
@type monitor() :: term()
Socket monitor event stream resource.
Common OMQ result shape.
@type send_opts() :: integer() | [ :sndmore | :noblock | :dontwait | {:flags, integer()} | {:routing_id, non_neg_integer()} ]
Send flags or option list.
@type socket() :: term()
Native OMQ socket resource.
Functions
AFFINITY option ID.
Return native backend name.
BACKLOG option ID.
Bind socket to endpoint and return bound endpoint.
Bind socket to random ephemeral port on address.
Bind socket to random port in inclusive range.
CHANNEL socket type constant.
CLIENT socket type constant.
Close socket with zero linger.
Close socket with explicit linger in milliseconds.
Return whether socket wrapper is closed.
CONFLATE option ID.
Connect socket to endpoint.
CONNECT_TIMEOUT option ID.
Return one connection snapshot by ID.
Return current connection snapshots for socket.
Create a context with one IO thread.
Create a context with requested native IO thread count.
Return whether this context wrapper or native core is closed.
Return process-wide singleton context.
Return process-wide singleton context, creating it with IO thread count.
CURVE mechanism constant.
Generate CURVE public/secret keypair.
Derive CURVE public key from secret key.
CURVE_PUBLICKEY option ID.
CURVE_SECRETKEY option ID.
CURVE_SERVER option ID.
CURVE_SERVERKEY option ID.
DEALER socket type constant.
Terminate a context. Alias for term/1.
Run libzmq-compatible device. Device type is accepted for parity.
Disconnect socket from endpoint.
DISH socket type constant.
DONTWAIT alias for NOBLOCK.
EVENTS option ID.
FD option ID.
FORWARDER device type constant.
GATHER socket type constant.
Get socket option. Alias for getsockopt/2.
Return SNDHWM as compatibility HWM value.
Get socket option by atom or integer option ID.
Get binary socket option as UTF-8 text.
HANDSHAKE_IVL option ID.
Return whether native feature or transport is available.
HEARTBEAT_IVL option ID.
HEARTBEAT_TIMEOUT option ID.
HEARTBEAT_TTL option ID.
HWM compatibility option ID.
IDENTITY option ID.
IMMEDIATE option ID.
Return process-wide singleton context.
Return process-wide singleton context, creating it with IO thread count.
IPV4ONLY option ID.
IPV6 option ID.
Join RADIO/DISH group.
LAST_ENDPOINT option ID.
Leave RADIO/DISH group.
LINGER option ID.
MAXMSGSIZE option ID.
MECHANISM option ID.
Create monitor stream for socket lifecycle events.
Receive next monitor event.
Receive next monitor event with timeout in milliseconds.
Try to receive one monitor event without blocking.
MULTICAST_HOPS option ID.
NOBLOCK send/receive flag.
NULL mechanism constant.
OMQ_COMPRESSION_AUTO_TRAIN option ID.
OMQ_COMPRESSION_DICT option ID.
OMQ_COMPRESSION_LEVEL option ID.
OMQ_ON_MUTE option ID.
OMQ_ON_MUTE block mode value.
OMQ_ON_MUTE drop-newest mode value.
OMQ_ON_MUTE drop-oldest mode value.
Return native binding version. Alias for version/0.
Return native binding version as {major, minor, patch}.
OMQ_WORKLOAD_PROFILE option ID.
PAIR socket type constant.
PEER socket type constant.
PLAIN mechanism constant.
PLAIN_PASSWORD option ID.
PLAIN_SERVER option ID.
Configures an exact, case-sensitive PLAIN server credential allowlist.
Call before bind, connect, send, or receive. Each username and password must contain at most 255 ASCII VCHAR bytes. An empty list rejects every client. PLAIN authenticates clients but does not encrypt traffic.
Configures a PLAIN server accepting one fixed credential pair.
The same validation and pre-use requirement as plain_server/2 applies.
PLAIN_USERNAME option ID.
Poll socket readiness entries with timeout in milliseconds.
POLLERR readiness flag.
POLLIN readiness flag.
POLLOUT readiness flag.
POLLPRI readiness flag.
PROBE_ROUTER option ID.
Run bidirectional proxy between two sockets.
Run bidirectional proxy and mirror traffic to capture socket.
Run steerable proxy with PAUSE, RESUME, and TERMINATE control.
PUB socket type constant.
PULL socket type constant.
PUSH socket type constant.
QUEUE device type constant.
RADIO socket type constant.
RATE option ID.
RCVBUF option ID.
RCVHWM option ID.
RCVMORE option ID.
RCVTIMEO option ID.
RECONNECT_IVL option ID.
RECONNECT_IVL_MAX option ID.
RECONNECT_STOP option ID.
RECOVERY_IVL option ID.
Receive one message using socket timeout options.
Receive one message with timeout in milliseconds.
Receive next frame from multipart message.
Receive next frame with timeout in milliseconds.
Receive one JSON value decoded by OTP json.
Receive one JSON value with timeout in milliseconds.
Receive one multipart message using socket timeout options.
Receive one multipart message with timeout in milliseconds.
Receive one UTF-8 string message.
Receive one string with timeout or wire encoding.
Receive one string with timeout and wire encoding.
Receive one Erlang term encoded by send_term/2,3.
Receive one Erlang term with timeout in milliseconds.
REP socket type constant.
REQ socket type constant.
REQ_CORRELATE option ID.
REQ_RELAXED option ID.
ROUTER socket type constant.
ROUTER_HANDOVER option ID.
ROUTER_MANDATORY option ID.
ROUTING_ID option ID.
SCATTER socket type constant.
Return ready read, write, and exception socket lists.
Send one binary message.
Send one binary message with flags or options.
Send RADIO message to group.
Send one JSON value encoded by OTP json.
Send one JSON value with flags or options.
Send one multipart message.
Send one multipart message with flags or options.
Send one UTF-8 string message.
Send string with options or source encoding.
Send string using requested wire encoding and options.
Send one Erlang term using external term format.
Send one Erlang term with flags or options.
SERVER socket type constant.
Set socket option. Alias for setsockopt/3.
Set both SNDHWM and RCVHWM.
Set socket option by atom or integer option ID.
Set binary socket option from UTF-8 text.
SNDBUF option ID.
SNDHWM option ID.
SNDMORE send flag.
SNDTIMEO option ID.
Create socket from context and socket type.
Return wrapper socket ID.
Return socket type atom.
STREAM socket type constant.
STREAMER device type constant.
Return POSIX strerror text for common libzmq errno values.
SUB socket type constant.
Subscribe SUB or XSUB socket to prefix.
SUBSCRIBE option ID.
TCP_ACCEPT_FILTER option ID.
TCP_KEEPALIVE option ID.
TCP_KEEPALIVE_CNT option ID.
TCP_KEEPALIVE_IDLE option ID.
TCP_KEEPALIVE_INTVL option ID.
TCP_MAXRT option ID.
Terminate a context.
Try to receive one message without blocking.
Try to receive one JSON value without blocking.
Try to receive one multipart message without blocking.
Try to receive one UTF-8 string without blocking.
Try to receive one string with wire encoding.
Try to receive one Erlang term without blocking.
Try to send one binary message without blocking.
Try to send one binary message with flags or options.
TYPE option ID.
Unbind socket from endpoint.
Remove SUB or XSUB prefix subscription.
UNSUBSCRIBE option ID.
Return native binding version.
Wait until at least min_peers peers are connected.
Wait until at least min_subscriptions subscriptions are visible.
XPUB socket type constant.
XPUB_VERBOSE option ID.
XSUB socket type constant.
ZAP_DOMAIN option ID.
Return libzmq compatibility version string.
Return libzmq compatibility version tuple.