public class Sockets extends Object
| Modifier and Type | Method and Description |
|---|---|
static Socket |
bind(SocketType socketType,
String url)
Create a ØMQ Socket and bind it to a given url.
|
static PollerBuilder |
buildPoller()
Create a builder capable of constructing a ØMQ Poller.
|
static ReactorBuilder |
buildReactor()
Create a builder capable of constructing a ØMQ Reactor.
|
static SocketBuilder |
buildSocket(SocketType socketType)
Create a builder capable of constructing ØMQ Sockets of the given socket type.
|
static Socket |
connect(SocketType socketType,
String url)
Create a ØMQ Socket and connect it to a given url.
|
static Socket |
fork(Backgroundable backgroundable)
Run a background thread with an inproc PAIR socket for communication.
|
static void |
forward(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up on another thread that exits when the
context is closed.
|
static Poller |
newPoller(PollListener listener,
List<Socket> sockets,
List<SelectableChannel> channels)
Create a ØMQ Poller with a single PollListener which handles incoming
messages from the given ØMQ Sockets and SelectableChannels.
|
static Poller |
newPoller(PollListener listener,
SelectableChannel... channels)
Create a ØMQ Poller with a single PollListener which handles incoming
messages from the given SelectableChannels.
|
static Poller |
newPoller(PollListener listener,
Socket... sockets)
Create a ØMQ Poller with a single PollListener which handles incoming
messages from the given ØMQ Sockets.
|
static Poller |
newPoller(PollListener listener,
Socket socket,
SelectableChannel channel)
Create a ØMQ Poller with a single PollListener which handles incoming
messages from the given ØMQ Socket and SelectableChannel.
|
static Reactor |
newReactor(LoopHandler handler,
List<Socket> sockets,
List<SelectableChannel> channels)
Create a ØMQ Reactor with a single LoopHandler which handles incoming
messages from the given ØMQ Sockets and SelectableChannels.
|
static Reactor |
newReactor(LoopHandler handler,
long interval,
TimeUnit unit)
Create a ØMQ Reactor with a single LoopHandler which initially handles
a repeating timer with the given interval.
|
static Reactor |
newReactor(LoopHandler handler,
SelectableChannel... channels)
Create a ØMQ Reactor with a single LoopHandler which handles incoming
messages from the given SelectableChannels.
|
static Reactor |
newReactor(LoopHandler handler,
Socket... sockets)
Create a ØMQ Reactor with a single LoopHandler which handles incoming
messages from the given ØMQ Sockets.
|
static Reactor |
newReactor(LoopHandler handler,
Socket socket,
SelectableChannel channel)
Create a ØMQ Reactor with a single LoopHandler which handles incoming
messages from the given ØMQ Socket and SelectableChannel.
|
static void |
proxy(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up.
|
static void |
start(DeviceType deviceType,
String frontendUrl,
String backendUrl)
Start a ØMQ Device of the given type, which will run in the background to
bridge two networks together.
|
public static SocketBuilder buildSocket(SocketType socketType)
socketType - The socket typepublic static Socket connect(SocketType socketType, String url)
socketType - The socket typeurl - The url to connect topublic static Socket bind(SocketType socketType, String url)
socketType - The socket typeurl - The url to bind topublic static PollerBuilder buildPoller()
public static Poller newPoller(PollListener listener, Socket... sockets)
listener - A listener for handling incoming messagessockets - One or more ØMQ Socketspublic static Poller newPoller(PollListener listener, SelectableChannel... channels)
listener - A listener for handling incoming messageschannels - One or more channels that can be multiplexed with ØMQ Socketspublic static Poller newPoller(PollListener listener, Socket socket, SelectableChannel channel)
listener - A listener for handling incoming messagessocket - A ØMQ Socketchannel - A selectable channel that can be multiplexed with ØMQ Socketspublic static Poller newPoller(PollListener listener, List<Socket> sockets, List<SelectableChannel> channels)
listener - A listener for handling incoming messagessockets - One or more ØMQ Socketschannels - One or more channels that can be multiplexed with ØMQ Socketspublic static ReactorBuilder buildReactor()
public static Reactor newReactor(LoopHandler handler, Socket... sockets)
handler - A handler for executing event-driven polling of Socketssockets - One or more ØMQ Socketspublic static Reactor newReactor(LoopHandler handler, SelectableChannel... channels)
handler - A handler for executing event-driven polling of Socketschannels - One or more channels that can be multiplexed with ØMQ Socketspublic static Reactor newReactor(LoopHandler handler, Socket socket, SelectableChannel channel)
handler - A handler for executing event-driven polling of Socketssocket - A ØMQ Socketchannel - A selectable channel that can be multiplexed with ØMQ Socketspublic static Reactor newReactor(LoopHandler handler, long interval, TimeUnit unit)
handler - A handler for executing event-driven polling of Socketsinterval - The initial and subsequet delay for a repeating timer eventunit - The time unit for the timer intervalpublic static Reactor newReactor(LoopHandler handler, List<Socket> sockets, List<SelectableChannel> channels)
handler - A handler for executing event-driven polling of Socketssockets - One or more ØMQ Socketschannels - One or more channels that can be multiplexed with ØMQ Socketspublic static void start(DeviceType deviceType, String frontendUrl, String backendUrl)
deviceType - The device type, specifying the pattern to usefrontendUrl - The front-end socket which will be proxied to/from the back-endbackendUrl - The back-end socket which will be proxied to/from the front-endpublic static void proxy(Socket frontEnd, Socket backEnd)
frontEnd - The front-end socket which will be proxied to/from the back-endbackEnd - The back-end socket which will be proxied to/from the front-endpublic static void forward(Socket frontEnd, Socket backEnd)
frontEnd - The front-end socket which will be proxied to/from the back-endbackEnd - The back-end socket which will be proxied to/from the front-endpublic static Socket fork(Backgroundable backgroundable)
backgroundable - The task to be performed on the background threadCopyright © 2019. All rights reserved.