Module: OMQ

Defined in:
lib/omq.rb,
lib/omq/pair.rb,
lib/omq/engine.rb,
lib/omq/socket.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/push_pull.rb,
lib/omq/drop_queue.rb,
lib/omq/routing/pub.rb,
lib/omq/routing/rep.rb,
lib/omq/routing/req.rb,
lib/omq/routing/sub.rb,
lib/omq/routing/pair.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/monitor_event.rb,
lib/omq/router_dealer.rb,
lib/omq/transport/ipc.rb,
lib/omq/transport/tcp.rb,
lib/omq/routing/dealer.rb,
lib/omq/routing/router.rb,
lib/omq/queue_interface.rb,
lib/omq/routing/fan_out.rb,
lib/omq/engine/heartbeat.rb,
lib/omq/engine/reconnect.rb,
lib/omq/engine/recv_pump.rb,
lib/omq/transport/inproc.rb,
lib/omq/routing/fair_recv.rb,
lib/omq/engine/maintenance.rb,
lib/omq/routing/fair_queue.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: DEALER, DropQueue, Engine, MonitorEvent, Options, PAIR, PUB, PULL, PUSH, REP, REQ, ROUTER, SUB, Socket, SocketDeadError, XPUB, XSUB

Constant Summary collapse

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,
]
VERSION =
"0.20.0"

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.)



13
14
15
# File 'lib/omq/monitor_event.rb', line 13

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



13
14
15
# File 'lib/omq/monitor_event.rb', line 13

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.)



13
14
15
# File 'lib/omq/monitor_event.rb', line 13

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.



57
58
59
60
61
62
# File 'lib/omq.rb', line 57

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