Package org.zeromq
Class ZEvent
java.lang.Object
org.zeromq.ZEvent
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.
| 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 |
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface used to consume events in monitor -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateZEvent(ZMQ.Event event, Function<Object, SelectableChannel> getResolveChannel) -
Method Summary
Modifier and TypeMethodDescriptionbooleangetEvent()<M> MgetValue()Return the value of the event as a high level java object.inthashCode()booleanisDebug()Used to check if the event is an error.booleanisError()Used to check if the event is an error.booleanUsed to check if the event is an information.booleanisWarn()Used to check if the event is a warning.static ZEventrecv(ZMQ.Socket socket) Receive an event from a monitor socket.static ZEventrecv(ZMQ.Socket socket, int flags) Receive an event from a monitor socket.(package private) static Objectresolve(ZMonitor.Event event, Object value, Function<Object, SelectableChannel> getResolveChannel) toString()
-
Field Details
-
event
-
value
-
address
-
-
Constructor Details
-
ZEvent
-
-
Method Details
-
resolve
static Object resolve(ZMonitor.Event event, Object value, Function<Object, SelectableChannel> getResolveChannel) -
getEvent
-
getValue
public <M> M getValue()Return the value of the event as a high level java object. It returns objects of type:-
ZMonitor.ProtocolCodefor a handshake protocol error. -
ZMQ.Errorfor any other error. -
Durationwhen associated with a delay. - null when no relevant value available.
- Type Parameters:
M- The expected type of the returned object- Returns:
- The resolved value.
-
-
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
-
hashCode
public int hashCode() -
toString
-
recv
Receive an event from a monitor socket.- Parameters:
socket- the monitor socketflags- 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
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
-