ZMQ.Event event = ZMQ.Event.recv(monitorSocket); close(); });
@Override public boolean stage(Socket socket, Socket pipe, ZPoller poller, int evts) { final ZMQ.Event event = ZMQ.Event.recv(socket); assert (event != null); final int code = event.getEvent(); final String address = event.getAddress(); assert (address != null); final Event type = Event.find(code); assert (type != null); final ZMsg msg = new ZMsg(); msg.add(type.name()); msg.add(Integer.toString(code)); msg.add(address); final Object value = event.getValue(); if (value != null) { msg.add(value.toString()); } return msg.send(pipe, true); }
/** * Receive an event from a monitor socket. * Does a blocking recv. * @param socket the socket * @return the received event. * @throws ZMQException */ public static Event recv(Socket socket) { return Event.recv(socket, 0); } }
/** * Receive an event from a monitor socket. * @param socket the socket * @param flags the flags to apply to the receive operation. * @return the received event or null if no message was received. * @throws ZMQException */ public static Event recv(Socket socket, int flags) { zmq.ZMQ.Event e = zmq.ZMQ.Event.read(socket.base, flags); return e != null ? new Event(e.event, e.arg, e.addr) : null; }
/** * Receive an event from a monitor socket. * For libzmq versions 3.2.x the address will be an empty string. * @param socket the socket * @param flags the flags to apply to the receive operation. * @return the received event or null if no message was received. * @throws ZMQException */ public static Event recv(Socket socket, int flags) throws ZMQException { return Event.recv(socket.socketHandle, flags); }
/** * Receive an event from a monitor socket. * Does a blocking recv. * For libzmq versions 3.2.x the address will be an empty string. * @param socket the socket * @return the received event. * @throws ZMQException */ public static Event recv(Socket socket) throws ZMQException { return Event.recv(socket, 0); } }