Module: NNQ

Defined in:
lib/nnq/bus.rb,
lib/nnq/pair.rb,
lib/nnq/error.rb,
lib/nnq/engine.rb,
lib/nnq/socket.rb,
lib/nnq/options.rb,
lib/nnq/pub_sub.rb,
lib/nnq/reactor.rb,
lib/nnq/req_rep.rb,
lib/nnq/version.rb,
lib/nnq/constants.rb,
lib/nnq/push_pull.rb,
lib/nnq/connection.rb,
lib/nnq/routing/bus.rb,
lib/nnq/routing/pub.rb,
lib/nnq/routing/rep.rb,
lib/nnq/routing/req.rb,
lib/nnq/routing/sub.rb,
lib/nnq/routing/pair.rb,
lib/nnq/routing/pull.rb,
lib/nnq/routing/push.rb,
lib/nnq/transport/ipc.rb,
lib/nnq/transport/tcp.rb,
lib/nnq/routing/rep_raw.rb,
lib/nnq/routing/req_raw.rb,
lib/nnq/engine/reconnect.rb,
lib/nnq/routing/surveyor.rb,
lib/nnq/transport/inproc.rb,
lib/nnq/routing/backtrace.rb,
lib/nnq/routing/send_pump.rb,
lib/nnq/routing/respondent.rb,
lib/nnq/surveyor_respondent.rb,
lib/nnq/routing/surveyor_raw.rb,
lib/nnq/transport/inproc/pipe.rb,
lib/nnq/routing/respondent_raw.rb,
lib/nnq/engine/socket_lifecycle.rb,
lib/nnq/engine/connection_lifecycle.rb

Defined Under Namespace

Modules: Reactor, Routing, Transport Classes: BUS0, ClosedError, Connection, ConnectionRejected, Engine, Error, MonitorEvent, Options, PAIR0, PUB0, PULL0, PUSH0, ProtocolError, REP0, REQ0, RESPONDENT0, RequestCancelled, SUB0, SURVEYOR0, Socket, TimedOut, TimeoutError

Constant Summary collapse

PAIR =
PAIR0
PUB =
PUB0
SUB =
SUB0
REQ =
REQ0
REP =
REP0
VERSION =
"0.7.0"
CONNECTION_LOST =

Errors that indicate an established connection went away. Used by the recv loop, routing pumps, and connection lifecycle to silently terminate (the connection lifecycle’s #lost! handler decides whether to reconnect). Not frozen at load time — transport plugins append to this before the first bind/connect, which freezes both arrays.

[
  EOFError,
  IOError,
  Errno::ECONNRESET,
  Errno::EPIPE,
]
CONNECTION_FAILED =

Errors raised when a peer cannot be reached. Triggers a reconnect retry rather than propagating.

[
  Errno::ECONNREFUSED,
  Errno::EHOSTUNREACH,
  Errno::ENETUNREACH,
  Errno::ENOENT,
  Errno::EPIPE,
  Errno::ETIMEDOUT,
  Socket::ResolutionError,
]
PUSH =
PUSH0
PULL =
PULL0

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#detailHash? (readonly)

Returns extra context.

Returns:

  • (Hash, nil)

    extra context



16
17
18
19
20
# File 'lib/nnq/constants.rb', line 16

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

#endpointString? (readonly)

Returns the endpoint involved.

Returns:

  • (String, nil)

    the endpoint involved



16
17
18
19
20
# File 'lib/nnq/constants.rb', line 16

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

#typeSymbol (readonly)

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

Returns:

  • (Symbol)

    event type (:listening, :connected, :disconnected, …)



16
17
18
19
20
# File 'lib/nnq/constants.rb', line 16

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

Class Method Details

.freeze_for_ractors!Object

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



53
54
55
56
57
# File 'lib/nnq/constants.rb', line 53

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