org.zeromq
Class ZMQ

java.lang.Object
  extended by org.zeromq.ZMQ

public class ZMQ
extends Object

ZeroMQ JNI Bindings.

Author:
Gonzalo Diethelm

Nested Class Summary
static class ZMQ.Context
          Inner class: Context.
static class ZMQ.Error
          Inner class: Error.
static class ZMQ.Poller
          Inner class: Poller.
static class ZMQ.PollItem
           
static class ZMQ.Socket
          Inner class: Socket.
 
Field Summary
static int DEALER
          Flag to specify a DEALER socket (aka XREQ).
static int DONTWAIT
           
static int DOWNSTREAM
          Deprecated. 
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
          Deprecated. 
static int XPUB
          Flag to specify a XPUB socket, receiving side must be a SUB or XSUB.
static int XREP
          Deprecated. As of release 3.0 of zeromq, replaced by ROUTER
static int XREQ
          Deprecated. 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.
 
Constructor Summary
ZMQ()
           
 
Method Summary
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 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 ØMQ 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()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NOBLOCK

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

See Also:
Constant Field Values

DONTWAIT

public static final int DONTWAIT
See Also:
Constant Field Values

SNDMORE

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

See Also:
Constant Field Values

PAIR

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

See Also:
Constant Field Values

PUB

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

See Also:
Constant Field Values

SUB

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

See Also:
Constant Field Values

REQ

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

See Also:
Constant Field Values

REP

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

XREQ

public static final int XREQ
Deprecated. 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.

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

XREP

public static final int XREP
Deprecated. 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.

See Also:
Constant Field Values

PULL

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

See Also:
Constant Field Values

PUSH

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

See Also:
Constant Field Values

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.

See Also:
Constant Field Values

XSUB

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

See Also:
Constant Field Values

STREAMER

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

See Also:
Constant Field Values

FORWARDER

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

See Also:
Constant Field Values

QUEUE

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

See Also:
Constant Field Values

UPSTREAM

@Deprecated
public static final int UPSTREAM
Deprecated. 
See Also:
PULL, Constant Field Values

DOWNSTREAM

@Deprecated
public static final int DOWNSTREAM
Deprecated. 
See Also:
PUSH, Constant Field Values
Constructor Detail

ZMQ

public ZMQ()
Method Detail

getMajorVersion

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

getMinorVersion

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

getPatchVersion

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

getFullVersion

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

makeVersion

public static int makeVersion(int major,
                              int minor,
                              int patch)
Parameters:
major - Version major component.
minor - Version minor component.
patch - Version patch component.
Returns:
Comparible single int version number.

getVersionString

public static String getVersionString()
Returns:
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 ØMQ 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.

Parameters:
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.
Since:
3.2.2

poll

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

Parameters:
items - polling items
timeout - timeout in millisecond
Returns:
number of events

poll

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

Parameters:
items - polling items
count - active item count
timeout - timeout in millisecond
Returns:
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.

Parameters:
ioThreads - Number of threads to use, usually 1 is sufficient for most use cases.
Returns:
the Context


Copyright © 2013. All Rights Reserved.