receiver – Receiver

The receiver is responsible for receiveing messages

class eventmq.receiver.Receiver(*args, **kwargs)

Receives messages and pass them to a on_recv.

Note

Polling with this reciever is currently only available via an eventloop (zmq.eventloop).

name

str – Name of this socket

zcontext

zmq.Context – socket context

zsocket

zmq.Socket – socket wrapped up in a zmqstream.ZMQStream

__init__(*args, **kwargs)

Note

All args are optional unless otherwise noted.

Parameters:
  • name (str) – name of this socket. By default a uuid will be generated
  • context (zmq.Context) – Context to use when buliding the socket
  • socket (zmq.Socket) – Should be one of zmq.REP or zmq.ROUTER. By default a ROUTER is used
  • skip_zmqstream (bool) – If set to true, skip creating the zmqstream socket. Callable is unused and optional when this is True
  • on_recv – REQUIRED for zmqstream mode. A function or method to call when a message is received
Raises:

TypeError – when callable is not callable

__weakref__

list of weak references to the object (if defined)

connect(addr=None)

Connect to address defined by addr

Parameters:addr (str) – Address to connect to as a connection string
Raises:Exception
listen(addr=None)

start listening on addr

Parameters:addr (str) – Address to listen on as a connction string
Raises:Exception
ready

Property used to check if this receiver is ready.

Returns:True if the receiver is ready to connect or listen, otherwise False
Return type:bool