org.zeromq
类 ZMQ

java.lang.Object
  继承者 org.zeromq.ZMQ

public class ZMQ
extends java.lang.Object

ZeroMQ JNI Bindings.


嵌套类摘要
static class ZMQ.Context
          Inner class: Context.
static class ZMQ.Error
          Inner class: Error.
static class ZMQ.Event
          Inner class: Event.
static class ZMQ.Poller
          Inner class: Poller.
static class ZMQ.PollItem
           
static class ZMQ.Socket
          Inner class: Socket.
 
字段摘要
static int DEALER
          Flag to specify a DEALER socket (aka XREQ).
static int DONTWAIT
           
static int DOWNSTREAM
          已过时。 
static int EVENT_ACCEPT_FAILED
          EVENT_ACCEPT_FAILED: could not accept client connection.
static int EVENT_ACCEPTED
          EVENT_ACCEPTED: connection accepted to bound interface.
static int EVENT_ALL
          EVENT_ALL: all events known by the java binding.
static int EVENT_BIND_FAILED
          EVENT_BIND_FAILED: socket could not bind to an address.
static int EVENT_CLOSE_FAILED
          EVENT_CLOSE_FAILED: connection couldn't be closed.
static int EVENT_CLOSED
          EVENT_CLOSED: connection closed.
static int EVENT_CONNECT_DELAYED
          EVENT_CONNECT_DELAYED: synchronous connect failed, it's being polled.
static int EVENT_CONNECT_RETRIED
          EVENT_CONNECT_RETRIED: asynchronous connect / reconnection attempt.
static int EVENT_CONNECTED
          EVENT_CONNECTED: connection established.
static int EVENT_DISCONNECTED
          EVENT_DISCONNECTED: broken session.
static int EVENT_LISTENING
          EVENT_LISTENING: socket bound to an address, ready to accept connections.
static int EVENT_MONITOR_STOPPED
          EVENT_MONITOR_STOPPED: monitor has been stopped.
static int FORWARDER
          Flag to specify a FORWARDER device.
static int NOBLOCK
          Socket flag to indicate a nonblocking send or recv mode.
static int PAIR
          Flag to specify a exclusive pair of items.
static int PUB
          Flag to specify a PUB socket, receiving side must be a SUB or XSUB.
static int PULL
          Flag to specify the receiving part of a PUSH socket.
static int PUSH
          Flag to specify a PUSH socket, receiving side must be a PULL.
static int QUEUE
          Flag to specify a QUEUE device.
static int REP
          Flag to specify the receiving part of a REQ socket.
static int REQ
          Flag to specify a REQ socket, receiving side must be a REP.
static int ROUTER
          Flag to specify ROUTER socket (aka XREP).
static int SNDMORE
          Socket flag to indicate that more message parts are coming.
static int STREAMER
          Flag to specify a STREAMER device.
static int SUB
          Flag to specify the receiving part of the PUB or XPUB socket.
static int UPSTREAM
          已过时。 
static int XPUB
          Flag to specify a XPUB socket, receiving side must be a SUB or XSUB.
static int XREP
          已过时。 As of release 3.0 of zeromq, replaced by ROUTER
static int XREQ
          已过时。 As of release 3.0 of zeromq, replaced by DEALER
static int XSUB
          Flag to specify the receiving part of the PUB or XPUB socket.
 
构造方法摘要
ZMQ()
           
 
方法摘要
static ZMQ.Context context(int ioThreads)
          Create a new Context.
protected static long EADDRINUSE()
           
protected static long EADDRNOTAVAIL()
           
protected static long ECONNREFUSED()
           
protected static long EFSM()
           
protected static long EHOSTUNREACH()
           
protected static long EINPROGRESS()
           
protected static long EMTHREAD()
           
protected static long ENETDOWN()
           
protected static long ENOBUFS()
           
protected static long ENOCOMPATPROTO()
           
protected static long ENOTSOCK()
           
protected static long ENOTSUP()
           
protected static long EPROTONOSUPPORT()
           
protected static long ETERM()
           
static int getFullVersion()
           
static int getMajorVersion()
           
static int getMinorVersion()
           
static int getPatchVersion()
           
static java.lang.String getVersionString()
           
protected static int make_version(int major, int minor, int patch)
           
static int makeVersion(int major, int minor, int patch)
           
static int poll(ZMQ.PollItem[] items, int count, long timeout)
          Poll on polling items until timeout
static int poll(ZMQ.PollItem[] items, long timeout)
          Poll on polling items until timeout
static void proxy(ZMQ.Socket frontend, ZMQ.Socket backend, ZMQ.Socket capture)
          Starts the built-in 0MQ proxy in the current application thread.
protected static int version_full()
           
protected static int version_major()
           
protected static int version_minor()
           
protected static int version_patch()
           
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

字段详细信息

NOBLOCK

public static final int NOBLOCK
Socket flag to indicate a nonblocking send or recv mode.

另请参见:
常量字段值

DONTWAIT

public static final int DONTWAIT
另请参见:
常量字段值

SNDMORE

public static final int SNDMORE
Socket flag to indicate that more message parts are coming.

另请参见:
常量字段值

PAIR

public static final int PAIR
Flag to specify a exclusive pair of items.

另请参见:
常量字段值

PUB

public static final int PUB
Flag to specify a PUB socket, receiving side must be a SUB or XSUB.

另请参见:
常量字段值

SUB

public static final int SUB
Flag to specify the receiving part of the PUB or XPUB socket.

另请参见:
常量字段值

REQ

public static final int REQ
Flag to specify a REQ socket, receiving side must be a REP.

另请参见:
常量字段值

REP

public static final int REP
Flag to specify the receiving part of a REQ socket.

另请参见:
常量字段值

DEALER

public static final int DEALER
Flag to specify a DEALER socket (aka XREQ). DEALER is really a combined ventilator / sink that does load-balancing on output and fair-queuing on input with no other semantics. It is the only socket type that lets you shuffle messages out to N nodes and shuffle the replies back, in a raw bidirectional asynch pattern.

另请参见:
常量字段值

XREQ

public static final int XREQ
已过时。 As of release 3.0 of zeromq, replaced by DEALER
Old alias for DEALER flag. Flag to specify a XREQ socket, receiving side must be a XREP.

另请参见:
常量字段值

ROUTER

public static final int ROUTER
Flag to specify ROUTER socket (aka XREP). ROUTER is the socket that creates and consumes request-reply routing envelopes. It is the only socket type that lets you route messages to specific connections if you know their identities.

另请参见:
常量字段值

XREP

public static final int XREP
已过时。 As of release 3.0 of zeromq, replaced by ROUTER
Old alias for ROUTER flag. Flag to specify the receiving part of a XREQ socket.

另请参见:
常量字段值

PULL

public static final int PULL
Flag to specify the receiving part of a PUSH socket.

另请参见:
常量字段值

PUSH

public static final int PUSH
Flag to specify a PUSH socket, receiving side must be a PULL.

另请参见:
常量字段值

XPUB

public static final int XPUB
Flag to specify a XPUB socket, receiving side must be a SUB or XSUB. Subscriptions can be received as a message. Subscriptions start with a '1' byte. Unsubscriptions start with a '0' byte.

另请参见:
常量字段值

XSUB

public static final int XSUB
Flag to specify the receiving part of the PUB or XPUB socket. Allows

另请参见:
常量字段值

STREAMER

public static final int STREAMER
Flag to specify a STREAMER device.

另请参见:
常量字段值

FORWARDER

public static final int FORWARDER
Flag to specify a FORWARDER device.

另请参见:
常量字段值

QUEUE

public static final int QUEUE
Flag to specify a QUEUE device.

另请参见:
常量字段值

UPSTREAM

@Deprecated
public static final int UPSTREAM
已过时。 
另请参见:
PULL, 常量字段值

DOWNSTREAM

@Deprecated
public static final int DOWNSTREAM
已过时。 
另请参见:
PUSH, 常量字段值

EVENT_CONNECTED

public static final int EVENT_CONNECTED
EVENT_CONNECTED: connection established. The EVENT_CONNECTED event triggers when a connection has been established to a remote peer. This can happen either synchronous or asynchronous. Value is the FD of the newly connected socket.

另请参见:
常量字段值

EVENT_CONNECT_DELAYED

public static final int EVENT_CONNECT_DELAYED
EVENT_CONNECT_DELAYED: synchronous connect failed, it's being polled. The EVENT_CONNECT_DELAYED event triggers when an immediate connection attempt is delayed and its completion is being polled for. Value has no meaning.

另请参见:
常量字段值

EVENT_CONNECT_RETRIED

public static final int EVENT_CONNECT_RETRIED
EVENT_CONNECT_RETRIED: asynchronous connect / reconnection attempt. The EVENT_CONNECT_RETRIED event triggers when a connection attempt is being handled by reconnect timer. The reconnect interval's recomputed for each attempt. Value is the reconnect interval.

另请参见:
常量字段值

EVENT_LISTENING

public static final int EVENT_LISTENING
EVENT_LISTENING: socket bound to an address, ready to accept connections. The EVENT_LISTENING event triggers when a socket's successfully bound to a an interface. Value is the FD of the newly bound socket.

另请参见:
常量字段值

EVENT_BIND_FAILED

public static final int EVENT_BIND_FAILED
EVENT_BIND_FAILED: socket could not bind to an address. The EVENT_BIND_FAILED event triggers when a socket could not bind to a given interface. Value is the errno generated by the bind call.

另请参见:
常量字段值

EVENT_ACCEPTED

public static final int EVENT_ACCEPTED
EVENT_ACCEPTED: connection accepted to bound interface. The EVENT_ACCEPTED event triggers when a connection from a remote peer has been established with a socket's listen address. Value is the FD of the accepted socket.

另请参见:
常量字段值

EVENT_ACCEPT_FAILED

public static final int EVENT_ACCEPT_FAILED
EVENT_ACCEPT_FAILED: could not accept client connection. The EVENT_ACCEPT_FAILED event triggers when a connection attempt to a socket's bound address fails. Value is the errno generated by accept.

另请参见:
常量字段值

EVENT_CLOSED

public static final int EVENT_CLOSED
EVENT_CLOSED: connection closed. The EVENT_CLOSED event triggers when a connection's underlying descriptor has been closed. Value is the former FD of the for the closed socket. FD has been closed already!

另请参见:
常量字段值

EVENT_CLOSE_FAILED

public static final int EVENT_CLOSE_FAILED
EVENT_CLOSE_FAILED: connection couldn't be closed. The EVENT_CLOSE_FAILED event triggers when a descriptor could not be released back to the OS. Implementation note: ONLY FOR IPC SOCKETS. Value is the errno generated by unlink.

另请参见:
常量字段值

EVENT_DISCONNECTED

public static final int EVENT_DISCONNECTED
EVENT_DISCONNECTED: broken session. The EVENT_DISCONNECTED event triggers when the stream engine (tcp and ipc specific) detects a corrupted / broken session. Value is the FD of the socket.

另请参见:
常量字段值

EVENT_MONITOR_STOPPED

public static final int EVENT_MONITOR_STOPPED
EVENT_MONITOR_STOPPED: monitor has been stopped. The EVENT_MONITOR_STOPPED event triggers when the monitor for a socket is stopped.

另请参见:
常量字段值

EVENT_ALL

public static final int EVENT_ALL
EVENT_ALL: all events known by the java binding. The EVENT_ALL constant can be used to set up a monitor for all events known by the java binding. One could add more flags

另请参见:
常量字段值
构造方法详细信息

ZMQ

public ZMQ()
方法详细信息

getMajorVersion

public static int getMajorVersion()
返回:
Major version number of the ZMQ library.

getMinorVersion

public static int getMinorVersion()
返回:
Major version number of the ZMQ library.

getPatchVersion

public static int getPatchVersion()
返回:
Major version number of the ZMQ library.

getFullVersion

public static int getFullVersion()
返回:
Full version number of the ZMQ library used for comparing versions.

makeVersion

public static int makeVersion(int major,
                              int minor,
                              int patch)
参数:
major - Version major component.
minor - Version minor component.
patch - Version patch component.
返回:
Comparible single int version number.

getVersionString

public static java.lang.String getVersionString()
返回:
String version number in the form major.minor.patch.

proxy

public static void proxy(ZMQ.Socket frontend,
                         ZMQ.Socket backend,
                         ZMQ.Socket capture)
Starts the built-in 0MQ proxy in the current application thread. The proxy connects a frontend socket to a backend socket. Conceptually, data flows from frontend to backend. Depending on the socket types, replies may flow in the opposite direction. The direction is conceptual only; the proxy is fully symmetric and there is no technical difference between frontend and backend. Before calling ZMQ.proxy() you must set any socket options, and connect or bind both frontend and backend sockets. The two conventional proxy models are: ZMQ.proxy() runs in the current thread and returns only if/when the current context is closed.

参数:
frontend - ZMQ.Socket
backend - ZMQ.Socket
capture - If the capture socket is not NULL, the proxy shall send all messages, received on both frontend and backend, to the capture socket. The capture socket should be a ZMQ_PUB, ZMQ_DEALER, ZMQ_PUSH, or ZMQ_PAIR socket.
从以下版本开始:
3.2.2

poll

public static int poll(ZMQ.PollItem[] items,
                       long timeout)
Poll on polling items until timeout

参数:
items - polling items
timeout - timeout in millisecond
返回:
number of events

poll

public static int poll(ZMQ.PollItem[] items,
                       int count,
                       long timeout)
Poll on polling items until timeout

参数:
items - polling items
count - active item count
timeout - timeout in millisecond
返回:
number of events

version_full

protected static int version_full()

version_major

protected static int version_major()

version_minor

protected static int version_minor()

version_patch

protected static int version_patch()

make_version

protected static int make_version(int major,
                                  int minor,
                                  int patch)

ENOTSUP

protected static long ENOTSUP()

EPROTONOSUPPORT

protected static long EPROTONOSUPPORT()

ENOBUFS

protected static long ENOBUFS()

ENETDOWN

protected static long ENETDOWN()

EADDRINUSE

protected static long EADDRINUSE()

EADDRNOTAVAIL

protected static long EADDRNOTAVAIL()

ECONNREFUSED

protected static long ECONNREFUSED()

EINPROGRESS

protected static long EINPROGRESS()

EHOSTUNREACH

protected static long EHOSTUNREACH()

EMTHREAD

protected static long EMTHREAD()

EFSM

protected static long EFSM()

ENOCOMPATPROTO

protected static long ENOCOMPATPROTO()

ETERM

protected static long ETERM()

ENOTSOCK

protected static long ENOTSOCK()

context

public static ZMQ.Context context(int ioThreads)
Create a new Context.

参数:
ioThreads - Number of threads to use, usually 1 is sufficient for most use cases.
返回:
the Context