Package org.zeromq

Class ZEvent

java.lang.Object
org.zeromq.ZEvent

public class ZEvent extends Object
A high level wrapper for an event that stores all value as Enum or java object instead of integer, and associate a severity with them. The events are handled using the following rules.
Events list
Event Value type Severity level
CONNECTED SelectableChannel debug
CONNECT_DELAYED ZMQ.Error or null if no error debug
CONNECT_RETRIED Duration debug
LISTENING SelectableChannel debug
BIND_FAILED ZMQ.Error or null if no error error
ACCEPTED SelectableChannel debug
ACCEPT_FAILED ZMQ.Error or null if no error error
CLOSED SelectableChannel debug
CLOSE_FAILED ZMQ.Error or null if no error error
DISCONNECTED SelectableChannel info
MONITOR_STOPPED null value debug
HANDSHAKE_FAILED_NO_DETAIL ZMQ.Error or null if no error error
HANDSHAKE_SUCCEEDED ZMQ.Error or null if no error debug
HANDSHAKE_FAILED_PROTOCOL ZMonitor.ProtocolCode error
HANDSHAKE_FAILED_AUTH Integer warn
HANDSHAKE_PROTOCOL Integer debug
  • Field Details

  • Constructor Details

  • Method Details

    • resolve

      static Object resolve(ZMonitor.Event event, Object value, Function<Object,SelectableChannel> getResolveChannel)
    • getEvent

      public ZMonitor.Event getEvent()
    • getValue

      public <M> M getValue()
      Return the value of the event as a high level java object. It returns objects of type:
      Type Parameters:
      M - The expected type of the returned object
      Returns:
      The resolved value.
    • getAddress

      public String getAddress()
    • isError

      public boolean isError()
      Used to check if the event is an error.

      Generally, any event that define the errno is considered as an error.

      Returns:
      true if the event was an error
    • isWarn

      public boolean isWarn()
      Used to check if the event is a warning.

      Generally, any event that return an authentication failure is considered as a warning.

      Returns:
      true if the event was a warning
    • isInformation

      public boolean isInformation()
      Used to check if the event is an information.

      Generally, any event that return an authentication failure is considered as a warning.

      Returns:
      true if the event was a warning
    • isDebug

      public boolean isDebug()
      Used to check if the event is an error.

      Generally, any event that define the errno is considered as an error.

      Returns:
      true if the event was an error
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • recv

      public static ZEvent recv(ZMQ.Socket socket, int flags)
      Receive an event from a monitor socket.
      Parameters:
      socket - the monitor socket
      flags - the flags to apply to the read operation.
      Returns:
      the received event or null if no message was received.
      Throws:
      ZMQException - In case of errors with the monitor socket
    • recv

      public static ZEvent recv(ZMQ.Socket socket)
      Receive an event from a monitor socket. Does a blocking recv.
      Parameters:
      socket - the monitor socket
      Returns:
      the received event or null if no message was received.
      Throws:
      ZMQException - In case of errors with the monitor socket