rad  3.0.0
Public Member Functions | List of all members
rad.services.pubsub.ZmqSubscriber Class Reference

Subscriber provides the capability to subscribe to protobuf ZMQ topics and being notified through callbacks to a (shared for all topics) handler. More...

Public Member Functions

def __init__ (self, *zmq.asyncio.Context zmq_ctx, asyncio.AbstractEventLoop loop, handler)
 
bool is_closed (self)
 Returns true if subscriber is not running, false otherwise. More...
 
def start (self)
 Start reading from socket. More...
 
def stop (self)
 Unbinds socket and shuts down all related tasks to this Replier. More...
 
def connect (self, str endpoint)
 Connect to endpoint. More...
 
def disconnect (self, str endpoint)
 Disconnect from endpoint. More...
 
def subscribe (self, topic_name)
 Subscribe on the topic topic_name. More...
 
def unsubscribe (self, topic_name)
 Unsubscribe to topic identified by topic_name. More...
 
def __init__ (self, *zmq.asyncio.Context zmq_ctx, asyncio.AbstractEventLoop loop, handler)
 
bool is_closed (self)
 Returns true if subscriber is not running, false otherwise. More...
 
def start (self)
 Start reading from socket. More...
 
def stop (self)
 Unbinds socket and shuts down all related tasks to this Replier. More...
 
def connect (self, str endpoint)
 Connect to endpoint. More...
 
def disconnect (self, str endpoint)
 Disconnect from endpoint. More...
 
def subscribe (self, topic_name)
 Subscribe on the topic topic_name. More...
 
def unsubscribe (self, topic_name)
 Unsubscribe to topic identified by topic_name. More...
 

Detailed Description

Subscriber provides the capability to subscribe to protobuf ZMQ topics and being notified through callbacks to a (shared for all topics) handler.

Constructor & Destructor Documentation

◆ __init__() [1/2]

def rad.services.pubsub.ZmqSubscriber.__init__ (   self,
*zmq.asyncio.Context  zmq_ctx,
asyncio.AbstractEventLoop  loop,
  handler 
)

◆ __init__() [2/2]

def rad.services.pubsub.ZmqSubscriber.__init__ (   self,
*zmq.asyncio.Context  zmq_ctx,
asyncio.AbstractEventLoop  loop,
  handler 
)

Member Function Documentation

◆ connect() [1/2]

def rad.services.pubsub.ZmqSubscriber.connect (   self,
str  endpoint 
)

Connect to endpoint.

◆ connect() [2/2]

def rad.services.pubsub.ZmqSubscriber.connect (   self,
str  endpoint 
)

Connect to endpoint.

◆ disconnect() [1/2]

def rad.services.pubsub.ZmqSubscriber.disconnect (   self,
str  endpoint 
)

Disconnect from endpoint.

◆ disconnect() [2/2]

def rad.services.pubsub.ZmqSubscriber.disconnect (   self,
str  endpoint 
)

Disconnect from endpoint.

◆ is_closed() [1/2]

bool rad.services.pubsub.ZmqSubscriber.is_closed (   self)

Returns true if subscriber is not running, false otherwise.

◆ is_closed() [2/2]

bool rad.services.pubsub.ZmqSubscriber.is_closed (   self)

Returns true if subscriber is not running, false otherwise.

◆ start() [1/2]

def rad.services.pubsub.ZmqSubscriber.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.pubsub.ZmqSubscriber.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.pubsub.ZmqSubscriber.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.

◆ stop() [2/2]

def rad.services.pubsub.ZmqSubscriber.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.

◆ subscribe() [1/2]

def rad.services.pubsub.ZmqSubscriber.subscribe (   self,
  topic_name 
)

Subscribe on the topic topic_name.

Note
ZMQ topic filtering is done simply on the start of the string, subscribing to 'foo' will match the published topic 'foobar'.
Params
topic_name Topic name (str or bytes).

◆ subscribe() [2/2]

def rad.services.pubsub.ZmqSubscriber.subscribe (   self,
  topic_name 
)

Subscribe on the topic topic_name.

Note
ZMQ topic filtering is done simply on the start of the string, subscribing to 'foo' will match the published topic 'foobar'.
Params
topic_name Topic name (str or bytes).

◆ unsubscribe() [1/2]

def rad.services.pubsub.ZmqSubscriber.unsubscribe (   self,
  topic_name 
)

Unsubscribe to topic identified by topic_name.

◆ unsubscribe() [2/2]

def rad.services.pubsub.ZmqSubscriber.unsubscribe (   self,
  topic_name 
)

Unsubscribe to topic identified by topic_name.


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