class CZTop::Proxy

Steerable proxy which switches messages between a frontend and a backend socket.

This is implemented using an {Actor}.

@see api.zeromq.org/czmq3-0:zproxy

Constants

ZPROXY_FPTR

function pointer to the +zmonitor()+ function

Attributes

actor[R]

@return [Actor] the actor behind this proxy

Public Class Methods

new() click to toggle source
# File lib/cztop/proxy.rb, line 18
def initialize
  @actor = Actor.new(ZPROXY_FPTR)
end

Public Instance Methods

backend() click to toggle source

Returns a configurator object which you can use to configure the backend socket. @return [Configurator] (memoized) backend configurator

# File lib/cztop/proxy.rb, line 48
def backend
  @backend ||= Configurator.new(self, :backend)
end
capture(endpoint) click to toggle source

Captures all proxied messages and delivers them to a PULL socket bound to the specified endpoint. @note The PULL socket has to be bound before calling this method. @param endpoint [String] the endpoint to which the PULL socket is bound to @return [void]

# File lib/cztop/proxy.rb, line 57
def capture(endpoint)
  @actor << ["CAPTURE", endpoint]
  @actor.wait
end
frontend() click to toggle source

Returns a configurator object which you can use to configure the frontend socket. @return [Configurator] (memoized) frontend configurator

# File lib/cztop/proxy.rb, line 41
def frontend
  @frontend ||= Configurator.new(self, :frontend)
end
pause() click to toggle source

Pauses proxying of any messages. @note This causes any messages to be queued up and potentialy hit the

high-water mark on the frontend or backend socket, causing messages to
be dropped or writing applications to block.

@return [void]

# File lib/cztop/proxy.rb, line 67
def pause
  @actor << "PAUSE"
  @actor.wait
end
resume() click to toggle source

Resume proxying of messages. @note This is only needed after a call to {#pause}, not to start the

proxy. Proxying starts as soon as the frontend and backend sockets are
properly attached.

@return [void]

# File lib/cztop/proxy.rb, line 77
def resume
  @actor << "RESUME"
  @actor.wait
end
terminate() click to toggle source

Terminates the proxy. @return [void]

# File lib/cztop/proxy.rb, line 27
def terminate
  @actor.terminate
end
verbose!() click to toggle source

Enable verbose logging of commands and activity. @return [void]

# File lib/cztop/proxy.rb, line 33
def verbose!
  @actor << "VERBOSE"
  @actor.wait
end