rad  3.0.0
Public Member Functions | List of all members
rad.services.msg.ZmqMsgReplier Class Reference

Public Member Functions

def __init__ (self, *str endpoint, zmq.asyncio.Context zmq_ctx, msg_handler, asyncio.AbstractEventLoop loop)
 
bool is_closed (self)
 Returns true if the socket is closed, true otherwise. More...
 
def start (self)
 Start reading from socket. More...
 
def send (self, bytes identity, bytes msg_name, bytes msg)
 Send msg with name msg_name to identity. More...
 
def stop (self)
 Unbinds socket and shuts down all related tasks to this Replier. More...
 
def __init__ (self, *str endpoint, zmq.asyncio.Context zmq_ctx, msg_handler, asyncio.AbstractEventLoop loop)
 
bool is_closed (self)
 Returns true if the socket is closed, true otherwise. More...
 
def start (self)
 Start reading from socket. More...
 
def send (self, bytes identity, bytes msg_name, bytes msg)
 Send msg with name msg_name to identity. More...
 
def stop (self)
 Unbinds socket and shuts down all related tasks to this Replier. More...
 

Constructor & Destructor Documentation

◆ __init__() [1/2]

def rad.services.msg.ZmqMsgReplier.__init__ (   self,
*str  endpoint,
zmq.asyncio.Context  zmq_ctx,
  msg_handler,
asyncio.AbstractEventLoop  loop 
)

◆ __init__() [2/2]

def rad.services.msg.ZmqMsgReplier.__init__ (   self,
*str  endpoint,
zmq.asyncio.Context  zmq_ctx,
  msg_handler,
asyncio.AbstractEventLoop  loop 
)

Member Function Documentation

◆ is_closed() [1/2]

bool rad.services.msg.ZmqMsgReplier.is_closed (   self)

Returns true if the socket is closed, true otherwise.

◆ is_closed() [2/2]

bool rad.services.msg.ZmqMsgReplier.is_closed (   self)

Returns true if the socket is closed, true otherwise.

◆ send() [1/2]

def rad.services.msg.ZmqMsgReplier.send (   self,
bytes  identity,
bytes  msg_name,
bytes  msg 
)

Send msg with name msg_name to identity.

        RuntimeError if socket is closed.

◆ send() [2/2]

def rad.services.msg.ZmqMsgReplier.send (   self,
bytes  identity,
bytes  msg_name,
bytes  msg 
)

Send msg with name msg_name to identity.

        RuntimeError if socket is closed.

◆ start() [1/2]

def rad.services.msg.ZmqMsgReplier.start (   self)

Start reading from socket.

   @todo: Return future instead?
Returns
Coroutine. The ZMQ socket reader coro that needs to be awaited on.

◆ start() [2/2]

def rad.services.msg.ZmqMsgReplier.start (   self)

Start reading from socket.

   @todo: Return future instead?
Returns
Coroutine. The ZMQ socket reader coro that needs to be awaited on.

◆ stop() [1/2]

def rad.services.msg.ZmqMsgReplier.stop (   self)

Unbinds socket and shuts down all related tasks to this Replier.

The ZmqMsgReplier is essentially dead after this.

Returns
Future that resolves once server has been closed.

Examples

>> import zmq >> import asyncio >> loop = asyncio.new_event_loop() >> def handler(identity, msg_name, msg): .. pass >> replier = ZmqMsgReplier(msg_handler=handler, .. endpoint='inproc://foobar', zmq_ctx=zmq.asyncio.Context(), loop=loop) >> fut = replier.stop() >> loop.run_until_complete(asyncio.wait_for(fut, 2)) >> loop.close()

◆ stop() [2/2]

def rad.services.msg.ZmqMsgReplier.stop (   self)

Unbinds socket and shuts down all related tasks to this Replier.

The ZmqMsgReplier is essentially dead after this.

Returns
Future that resolves once server has been closed.

Examples

>> import zmq >> import asyncio >> loop = asyncio.new_event_loop() >> def handler(identity, msg_name, msg): .. pass >> replier = ZmqMsgReplier(msg_handler=handler, .. endpoint='inproc://foobar', zmq_ctx=zmq.asyncio.Context(), loop=loop) >> fut = replier.stop() >> loop.run_until_complete(asyncio.wait_for(fut, 2)) >> loop.close()


The documentation for this class was generated from the following file: