public interface Context extends Closeable
Modifier and Type | Method and Description |
---|---|
BeaconReactorBuilder |
buildBeaconReactor()
Create a new BeaconReactor, which will send and receive UDP beacons
on a broadcast address, with event-driven handling of received beacons.
|
BinaryStarReactorBuilder |
buildBinaryStarReactor()
Create a new BinaryStarReactor, which will create one half of an HA-pair
with event-driven polling of a client Socket.
|
BinaryStarSocketBuilder |
buildBinaryStarSocket()
Create a ØMQ Socket, backed by a background agent that is connecting
to a BinaryStarReactor HA-pair.
|
CloneClientBuilder |
buildCloneClient()
Create a new CloneClient, connected to an HA-pair, for publishing key/value data
to anonymous peers.
|
CloneServerBuilder |
buildCloneServer()
Create a new CloneServer, which will create one half of an HA-pair
for distributing key/value data to clients.
|
DeviceBuilder |
buildDevice(DeviceType deviceType)
Create a ØMQ Device of type DeviceType, which will bridge two networks
together using patterns for specific SocketTypes.
|
PollerBuilder |
buildPoller()
Create a new Poller, which will allow callback-based polling of Sockets.
|
ReactorBuilder |
buildReactor()
Create a new Reactor, which will allow event-driven and timer-based
polling of Sockets.
|
SocketBuilder |
buildSocket(SocketType type)
Create a ØMQ Socket of type SocketType
|
void |
close()
Close the context and any open sockets.
|
Socket |
fork(Backgroundable backgroundable)
Run a background thread with an inproc PAIR socket for communication.
|
void |
fork(Socket socket,
Backgroundable backgroundable)
Run a background thread using the given socket for communication.
|
void |
forward(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up on another thread that exits when the
context is closed.
|
int |
getFullVersion() |
String |
getVersionString() |
Pollable |
newPollable(SelectableChannel channel,
PollerType... options)
Create a new Pollable from the socket, with the requested options.
|
Pollable |
newPollable(Socket socket,
PollerType... options)
Create a new Pollable from the socket, with the requested options.
|
void |
proxy(Socket frontEnd,
Socket backEnd)
Create a ØMQ proxy and start it up.
|
void |
queue(Socket frontEnd,
Socket backEnd)
|
Context |
shadow()
Create a new Context with the same underlying ØMQ context, with an empty
(separate) list of managed Sockets and Backgroundables.
|
void |
terminate()
Asynchronously terminate the context without closing any open sockets,
forcing pollers and waiters to abort.
|
SocketBuilder buildSocket(SocketType type)
type
- socket typeString getVersionString()
int getFullVersion()
PollerBuilder buildPoller()
Pollable
,
PollerType
ReactorBuilder buildReactor()
BinaryStarReactorBuilder buildBinaryStarReactor()
BinaryStarSocketBuilder buildBinaryStarSocket()
CloneServerBuilder buildCloneServer()
CloneClientBuilder buildCloneClient()
BeaconReactorBuilder buildBeaconReactor()
DeviceBuilder buildDevice(DeviceType deviceType)
deviceType
- The device type, specifying the pattern to usePollable newPollable(Socket socket, PollerType... options)
socket
- A socket to wrap for pollingoptions
- Polling options (IN, OUT, ERROR)Pollable newPollable(SelectableChannel channel, PollerType... options)
channel
- A channel to wrap for pollingoptions
- Polling options (IN, OUT, ERROR)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-endvoid 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-endvoid queue(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-endSocket fork(Backgroundable backgroundable)
backgroundable
- The task to be performed on the background threadvoid fork(Socket socket, Backgroundable backgroundable)
socket
- The socket owned by the background threadbackgroundable
- The task to be performed on the background threadContext shadow()
The returned context will not attempt to terminate the underlying ØMQ context when closed, and will only close managed sockets, etc.
void close()
close
in interface AutoCloseable
close
in interface Closeable
void terminate()
Copyright © 2019. All rights reserved.