Classes for running 0MQ Devices in the background.
Base class for launching Devices in background processes and threads.
Enqueue ZMQ address for binding on in_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for binding on out_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for connecting on in_socket.
See zmq.Socket.connect for details.
Enqueue ZMQ address for connecting on out_socket.
See zmq.Socket.connect for details.
Returns a global Context instance.
Most single-threaded applications have a single, global Context. Use this method instead of passing around Context instances throughout your code.
A common pattern for classes that depend on Contexts is to use a default argument to enable programs with multiple Contexts but not require the argument for simpler applications:
- class MyClass(object):
- def __init__(self, context=None):
- self.context = context or Context.instance()
The runner method.
Do not call me directly, instead call self.start(), just like a Thread.
Enqueue setsockopt(opt, value) for in_socket
See zmq.Socket.setsockopt for details.
Enqueue setsockopt(opt, value) for out_socket
See zmq.Socket.setsockopt for details.
A Threadsafe 0MQ Device.
Warning as with most ‘threadsafe’ Python objects, this is only threadsafe as long as you do not use private methods or attributes. Private names are prefixed with ‘_’, such as self._setup_socket().
For thread safety, you do not pass Sockets to this, but rather Socket types:
Device(device_type, in_socket_type, out_socket_type)
For instance:
dev = Device(zmq.QUEUE, zmq.DEALER, zmq.ROUTER)
Similar to zmq.device, but socket types instead of sockets themselves are passed, and the sockets are created in the work thread, to avoid issues with thread safety. As a result, additional bind_{in|out} and connect_{in|out} methods and setsockopt_{in|out} allow users to specify connections for the sockets.
Parameters : | device_type : int
{in|out}_type : int
|
---|---|
Attributes : | daemon : int
context_factory : callable (class attribute)
|
Methods : | bind_{in_out}(iface) :
connect_{in_out}(iface) :
setsockopt_{in_out}(opt,value) :
|
Enqueue ZMQ address for binding on in_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for binding on out_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for connecting on in_socket.
See zmq.Socket.connect for details.
Enqueue ZMQ address for connecting on out_socket.
See zmq.Socket.connect for details.
Returns a global Context instance.
Most single-threaded applications have a single, global Context. Use this method instead of passing around Context instances throughout your code.
A common pattern for classes that depend on Contexts is to use a default argument to enable programs with multiple Contexts but not require the argument for simpler applications:
- class MyClass(object):
- def __init__(self, context=None):
- self.context = context or Context.instance()
wait for me to finish, like Thread.join.
Reimplemented appropriately by sublcasses.
The runner method.
Do not call me directly, instead call self.start(), just like a Thread.
Enqueue setsockopt(opt, value) for in_socket
See zmq.Socket.setsockopt for details.
Enqueue setsockopt(opt, value) for out_socket
See zmq.Socket.setsockopt for details.
Start the device. Override me in subclass for other launchers.
A Device that will be run in a background Process.
See Device for details.
Enqueue ZMQ address for binding on in_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for binding on out_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for connecting on in_socket.
See zmq.Socket.connect for details.
Enqueue ZMQ address for connecting on out_socket.
See zmq.Socket.connect for details.
alias of Context
The runner method.
Do not call me directly, instead call self.start(), just like a Thread.
Enqueue setsockopt(opt, value) for in_socket
See zmq.Socket.setsockopt for details.
Enqueue setsockopt(opt, value) for out_socket
See zmq.Socket.setsockopt for details.
A Device that will be run in a background Thread.
See Device for details.
Enqueue ZMQ address for binding on in_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for binding on out_socket.
See zmq.Socket.bind for details.
Enqueue ZMQ address for connecting on in_socket.
See zmq.Socket.connect for details.
Enqueue ZMQ address for connecting on out_socket.
See zmq.Socket.connect for details.
Returns a global Context instance.
Most single-threaded applications have a single, global Context. Use this method instead of passing around Context instances throughout your code.
A common pattern for classes that depend on Contexts is to use a default argument to enable programs with multiple Contexts but not require the argument for simpler applications:
- class MyClass(object):
- def __init__(self, context=None):
- self.context = context or Context.instance()
The runner method.
Do not call me directly, instead call self.start(), just like a Thread.
Enqueue setsockopt(opt, value) for in_socket
See zmq.Socket.setsockopt for details.
Enqueue setsockopt(opt, value) for out_socket
See zmq.Socket.setsockopt for details.