public enum SocketType extends Enum<SocketType>
| Enum Constant and Description |
|---|
DEALER
Flag to specify a DEALER socket (aka XREQ).
|
PAIR
Flag to specify a exclusive pair of sockets.
|
PUB
Flag to specify a PUB socket, receiving side must be a SUB or XSUB.
|
PULL
Flag to specify the receiving part of a PUSH socket.
|
PUSH
Flag to specify a PUSH socket, receiving side must be a PULL.
|
REP
Flag to specify the receiving part of a REQ or DEALER socket.
|
REQ
Flag to specify a REQ socket, receiving side must be a REP or ROUTER.
|
ROUTER
Flag to specify ROUTER socket (aka XREP).
|
STREAM
Flag to specify a STREAM socket.
|
SUB
Flag to specify the receiving part of the PUB or XPUB socket.
|
XPUB
Flag to specify a XPUB socket, receiving side must be a SUB or XSUB.
|
XSUB
Flag to specify the receiving part of the PUB or XPUB socket.
|
| Modifier and Type | Field and Description |
|---|---|
int |
type |
| Modifier and Type | Method and Description |
|---|---|
int |
type() |
static SocketType |
type(int baseType) |
static SocketType |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SocketType[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SocketType PAIR
Flag to specify a exclusive pair of sockets.
A socket of type PAIR can only be connected to a single peer at any one time.| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | PAIR |
| Direction | Bidirectional |
| Send/receive pattern | Unrestricted |
| Incoming routing strategy | N/A |
| Outgoing routing strategy | N/A |
| Action in mute state | Block |
PAIR sockets are designed for inter-thread communication across the inproc transport and do not implement functionality such as auto-reconnection. PAIR sockets are considered experimental and may have other missing or broken aspects.
public static final SocketType PUB
Flag to specify a PUB socket, receiving side must be a SUB or XSUB.
A socket of type PUB is used by a publisher to distribute data.ZMQ.Socket.recv() function is not implemented for this socket type.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.SUB, ZMQ.XSUB |
| Direction | Unidirectional |
| Send/receive pattern | Send only |
| Incoming routing strategy | N/A |
| Outgoing routing strategy | Fan out |
| Action in mute state | Drop |
public static final SocketType SUB
Flag to specify the receiving part of the PUB or XPUB socket.
A socket of type SUB is used by a subscriber to subscribe to data distributed by a publisher.ZMQ.Socket.subscribe(byte[]) option to specify which messages to subscribe to.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.PUB, ZMQ.XPUB |
| Direction | Unidirectional |
| Send/receive pattern | Receive only |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | N/A |
public static final SocketType REQ
Flag to specify a REQ socket, receiving side must be a REP or ROUTER.
A socket of type REQ is used by a client to send requests to and receive replies from a service.| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.REP, ZMQ.ROUTER |
| Direction | Bidirectional |
| Send/receive pattern | Send, Receive, Send, Receive, ... |
| Incoming routing strategy | Last peer |
| Outgoing routing strategy | Round-robin |
| Action in mute state | Block |
public static final SocketType REP
Flag to specify the receiving part of a REQ or DEALER socket.
A socket of type REP is used by a service to receive requests from and send replies to a client.| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.REQ, ZMQ.DEALER |
| Direction | Bidirectional |
| Send/receive pattern | Receive, Send, Receive, Send, ... |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | Last peer |
public static final SocketType 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.ZMQ.REP socket each message sent must consist of
an empty message part, the delimiter, followed by one or more body parts.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.ROUTER, ZMQ.REP, ZMQ.DEALER |
| Direction | Bidirectional |
| Send/receive pattern | Unrestricted |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | Round-robin |
| Action in mute state | Block |
public static final SocketType 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.ZMQ.Socket.setRouterMandatory(boolean) socket option is set to true.
ZMQ.Socket.setRouterMandatory(boolean) socket option is set to true.
ZMQ.REQ socket is connected to a ROUTER socket, in addition to the identity of the originating peer
each message received shall contain an empty delimiter message part.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.DEALER, ZMQ.REQ, ZMQ.ROUTER |
| Direction | Bidirectional |
| Send/receive pattern | Unrestricted |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | See text |
| Action in mute state | Drop (See text) |
public static final SocketType PULL
Flag to specify the receiving part of a PUSH socket.
A socket of type ZMQ_PULL is used by a pipeline node to receive messages from upstream pipeline nodes.| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.PUSH |
| Direction | Unidirectional |
| Send/receive pattern | Receive only |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | N/A |
| Action in mute state | Block |
public static final SocketType PUSH
Flag to specify a PUSH socket, receiving side must be a PULL.
A socket of type PUSH is used by a pipeline node to send messages to downstream pipeline nodes.| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.PULL |
| Direction | Unidirectional |
| Send/receive pattern | Send only |
| Incoming routing strategy | N/A |
| Outgoing routing strategy | Round-robin |
| Action in mute state | Block |
public static final SocketType 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.ZMQ.PUB except that you can receive subscriptions from the peers in form of incoming messages.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.SUB, ZMQ.XSUB |
| Direction | Unidirectional |
| Send/receive pattern | Send messages, receive subscriptions |
| Incoming routing strategy | N/A |
| Outgoing routing strategy | Fan out |
| Action in mute state | Drop |
public static final SocketType XSUB
Flag to specify the receiving part of the PUB or XPUB socket.
Same asZMQ.SUB except that you subscribe by sending subscription messages to the socket.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | ZMQ.PUB, ZMQ.XPUB |
| Direction | Unidirectional |
| Send/receive pattern | Receive messages, send subscriptions |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | N/A |
| Action in mute state | Drop |
public static final SocketType STREAM
Flag to specify a STREAM socket.
A socket of type STREAM is used to send and receive TCP data from a non-ØMQ peer, when using the tcp:// transport. A STREAM socket can act as client and/or server, sending and/or receiving TCP data asynchronously.ZMQ.Socket.connect(String) call, and then fetch the socket identity using the ZMQ.Socket.getIdentity() call.
To close a specific connection, send the identity frame followed by a zero-length message.
When a connection is made, a zero-length message will be received by the application.
Similarly, when the peer disconnects (or the connection is lost), a zero-length message will be received by the application.
The ZMQ.SNDMORE flag is ignored on data frames. You must send one identity frame followed by one data frame.
| Summary of socket characteristics | |
|---|---|
| Compatible peer sockets | none |
| Direction | Bidirectional |
| Send/receive pattern | Unrestricted |
| Incoming routing strategy | Fair-queued |
| Outgoing routing strategy | See text |
| Action in mute state | EAGAIN |
public static SocketType[] values()
for (SocketType c : SocketType.values()) System.out.println(c);
public static SocketType valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant with the specified nameNullPointerException - if the argument is nullpublic static SocketType type(int baseType)
public int type()
Copyright © 2020. All rights reserved.