Module: OMQ

Defined in:
lib/omq/pair.rb,
lib/omq/peer.rb,
lib/omq/engine.rb,
lib/omq/socket.rb,
lib/omq/channel.rb,
lib/omq/options.rb,
lib/omq/pub_sub.rb,
lib/omq/reactor.rb,
lib/omq/req_rep.rb,
lib/omq/routing.rb,
lib/omq/version.rb,
lib/omq/readable.rb,
lib/omq/writable.rb,
lib/omq/constants.rb,
lib/omq/push_pull.rb,
lib/omq/drop_queue.rb,
lib/omq/radio_dish.rb,
lib/omq/routing/pub.rb,
lib/omq/routing/rep.rb,
lib/omq/routing/req.rb,
lib/omq/routing/sub.rb,
lib/omq/routing/dish.rb,
lib/omq/routing/pair.rb,
lib/omq/routing/peer.rb,
lib/omq/routing/pull.rb,
lib/omq/routing/push.rb,
lib/omq/routing/xpub.rb,
lib/omq/routing/xsub.rb,
lib/omq/single_frame.rb,
lib/omq/client_server.rb,
lib/omq/router_dealer.rb,
lib/omq/routing/radio.rb,
lib/omq/transport/ipc.rb,
lib/omq/transport/tcp.rb,
lib/omq/transport/udp.rb,
lib/omq/routing/client.rb,
lib/omq/routing/dealer.rb,
lib/omq/routing/gather.rb,
lib/omq/routing/router.rb,
lib/omq/routing/server.rb,
lib/omq/scatter_gather.rb,
lib/omq/queue_interface.rb,
lib/omq/routing/channel.rb,
lib/omq/routing/fan_out.rb,
lib/omq/routing/scatter.rb,
lib/omq/engine/heartbeat.rb,
lib/omq/engine/reconnect.rb,
lib/omq/engine/recv_pump.rb,
lib/omq/transport/inproc.rb,
lib/omq/engine/maintenance.rb,
lib/omq/routing/round_robin.rb,
lib/omq/routing/conn_send_pump.rb,
lib/omq/engine/socket_lifecycle.rb,
lib/omq/engine/connection_lifecycle.rb,
lib/omq/transport/inproc/direct_pipe.rb

Defined Under Namespace

Modules: QueueReadable, QueueWritable, Reactor, Readable, Routing, SingleFrame, Transport, Writable Classes: CHANNEL, CLIENT, DEALER, DISH, DropQueue, Engine, GATHER, MonitorEvent, Options, PAIR, PEER, PUB, PULL, PUSH, RADIO, REP, REQ, ROUTER, SCATTER, SERVER, SUB, Socket, SocketDeadError, XPUB, XSUB

Constant Summary collapse

VERSION =
"0.23.0"
DEBUG =

When OMQ_DEBUG is set, silent rescue clauses print the exception to stderr so transport/engine bugs surface immediately.

!!ENV["OMQ_DEBUG"]
CONNECTION_LOST =

Errors raised when a peer disconnects or resets the connection. Not frozen at load time — transport plugins append to this before the first bind/connect, which freezes both arrays.

[
  EOFError,
  IOError,
  Errno::EPIPE,
  Errno::ECONNRESET,
  Errno::ECONNABORTED,
  Errno::ENOTCONN,
  IO::Stream::ConnectionResetError,
]
CONNECTION_FAILED =

Errors raised when a peer cannot be reached.

[
  Errno::ECONNREFUSED,
  Errno::ENOENT,
  Errno::ETIMEDOUT,
  Errno::EHOSTUNREACH,
  Errno::ENETUNREACH,
  Errno::EPROTOTYPE, # IPC: existing socket file is SOCK_DGRAM, not SOCK_STREAM
  Socket::ResolutionError,
]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#detailHash? (readonly)

Returns extra context (e.g. { error: }, { interval: }, etc.).

Returns:

  • (Hash, nil)

    extra context (e.g. { error: }, { interval: }, etc.)



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end

#endpointString? (readonly)

Returns the endpoint involved.

Returns:

  • (String, nil)

    the endpoint involved



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end

#typeSymbol (readonly)

Returns event type (:listening, :connected, :disconnected, etc.).

Returns:

  • (Symbol)

    event type (:listening, :connected, :disconnected, etc.)



28
29
30
# File 'lib/omq/constants.rb', line 28

MonitorEvent = Data.define(:type, :endpoint, :detail) do
  def initialize(type:, endpoint: nil, detail: nil) = super
end

Class Method Details

.freeze_for_ractors!Object

Freezes module-level state so OMQ sockets can be used inside Ractors. Call this once before spawning any Ractors that create OMQ sockets.



62
63
64
65
66
67
# File 'lib/omq/constants.rb', line 62

def self.freeze_for_ractors!
  CONNECTION_LOST.freeze
  CONNECTION_FAILED.freeze
  Engine.transports.freeze
  Routing.registry.freeze
end