class CZTop::Proxy
Steerable proxy which switches messages between a frontend and a backend socket.
This is implemented using an {Actor}.
Constants
- ZPROXY_FPTR
function pointer to the +zmonitor()+ function
Attributes
@return [Actor] the actor behind this proxy
Public Class Methods
# File lib/cztop/proxy.rb, line 21 def initialize @actor = Actor.new(ZPROXY_FPTR) end
Public Instance Methods
Returns a configurator object which you can use to configure the backend socket. @return [Configurator] (memoized) backend configurator
# File lib/cztop/proxy.rb, line 54 def backend @backend ||= Configurator.new(self, :backend) end
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 64 def capture(endpoint) @actor << ['CAPTURE', endpoint] @actor.wait end
Returns a configurator object which you can use to configure the frontend socket. @return [Configurator] (memoized) frontend configurator
# File lib/cztop/proxy.rb, line 46 def frontend @frontend ||= Configurator.new(self, :frontend) end
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 75 def pause @actor << 'PAUSE' @actor.wait end
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 86 def resume @actor << 'RESUME' @actor.wait end
Terminates the proxy. @return [void]
# File lib/cztop/proxy.rb, line 30 def terminate @actor.terminate end
Enable verbose logging of commands and activity. @return [void]
# File lib/cztop/proxy.rb, line 37 def verbose! @actor << 'VERBOSE' @actor.wait end