Package org.zeromq

Interface ZProxy.Proxy

All Known Implementing Classes:
ZProxy.Proxy.SimpleProxy
Enclosing class:
ZProxy

public static interface ZProxy.Proxy
  • Method Details

    • create

      ZMQ.Socket create(ZContext ctx, ZProxy.Plug place, Object... args)
      Creates and initializes (bind, options ...) the socket for the given plug in the proxy. The proxy will close them afterwards, and the context as well if not provided in the constructor. There is no need to keep a reference on the created socket or the context given in parameter.
      Parameters:
      ctx - the context used for initialization.
      place - the position for the future created socket in the proxy.
      args - the optional array of arguments that has been passed at the creation of the ZProxy.
      Returns:
      the created socket. Possibly null only for capture.
    • configure

      boolean configure(ZMQ.Socket socket, ZProxy.Plug place, Object... args) throws IOException
      Configures the given socket.
      Parameters:
      socket - the socket to configure
      place - the position for the socket in the proxy
      args - the optional array of arguments that has been passed at the creation of the ZProxy.
      Returns:
      true if successfully configured, otherwise false
      Throws:
      IOException
    • restart

      boolean restart(ZMsg cfg, ZMQ.Socket socket, ZProxy.Plug place, Object... args) throws IOException
      Performs a hot restart of the given socket. Usually an unbind/bind but you can use whatever method you like.
      Parameters:
      cfg - the custom configuration message sent by the control.
      socket - the socket to hot restart
      place - the position for the socket in the proxy
      args - the optional array of arguments that has been passed at the creation of the ZProxy.
      Returns:
      true to perform a cold restart instead, false to do nothing. All the results will be collected from calls for all plugs. If any of them returns true, the cold restart is performed.
      Throws:
      IOException
    • configure

      boolean configure(ZMQ.Socket pipe, ZMsg cfg, ZMQ.Socket frontend, ZMQ.Socket backend, ZMQ.Socket capture, Object... args)
      Configures the proxy with a custom message. Note: you need to send one (1) mandatory custom response message with the pipe before the end of this call.
      Parameters:
      pipe - the control pipe
      cfg - the custom configuration message sent by the control
      frontend - the frontend socket
      backend - the backend socket
      capture - the optional capture socket
      args - the optional array of arguments that has been passed at the creation of the ZProxy.
      Returns:
      true to continue the proxy, false to exit
    • custom

      boolean custom(ZMQ.Socket pipe, String cmd, ZMQ.Socket frontend, ZMQ.Socket backend, ZMQ.Socket capture, Object... args)
      Handles a custom command not recognized by the proxy. Note: you need to send the current state at the end of the call.
      Parameters:
      pipe - the control pipe
      cmd - the unrecognized command
      frontend - the frontend socket
      backend - the backend socket
      capture - the optional capture socket
      args - the optional array of arguments that has been passed at the creation of the ZProxy.
      Returns:
      true to continue the proxy, false to exit