Public Member Functions | Public Attributes | Static Public Attributes | List of all members
rosbridge_library.internal.publishers.PublisherConsistencyListener Class Reference
Inheritance diagram for rosbridge_library.internal.publishers.PublisherConsistencyListener:
Inheritance graph
[legend]

Public Member Functions

def attach (self, publisher)
 
def detach (self)
 
def peer_subscribe (self, topic_name, topic_publish, peer_publish)
 
def publish_override (self, message)
 
def timed_out (self)
 

Public Attributes

 attached
 
 established_time
 
 lock
 
 msg_buffer
 
 publish
 
 publisher
 

Static Public Attributes

bool attached = False
 
int timeout = 1
 

Detailed Description

This class is used to solve the problem that sometimes we create a
publisher and then immediately publish a message, before the subscribers
have set up their connections.

Call attach() to attach the listener to a publisher.  It sets up a buffer
of outgoing messages, then when a new connection occurs, sends the messages
in the buffer.

Call detach() to detach the listener from the publisher and restore the
original publish methods.

After some particular timeout (default to 1 second), the listener stops
buffering messages as it is assumed by this point all subscribers will have
successfully set up their connections.

Definition at line 44 of file publishers.py.

Member Function Documentation

def rosbridge_library.internal.publishers.PublisherConsistencyListener.attach (   self,
  publisher 
)
Overrides the publisher's publish method, and attaches a subscribe
listener to the publisher, effectively routing incoming connections
and outgoing publish requests through this class instance 

Definition at line 63 of file publishers.py.

def rosbridge_library.internal.publishers.PublisherConsistencyListener.detach (   self)
Restores the publisher's original publish method and unhooks the
subscribe listeners, effectively finishing with this object 

Definition at line 79 of file publishers.py.

def rosbridge_library.internal.publishers.PublisherConsistencyListener.peer_subscribe (   self,
  topic_name,
  topic_publish,
  peer_publish 
)
Called whenever there's a new subscription.

If we're still inside the subscription setup window, then we publish
any buffered messages to the peer.

We also check if we're timed out, but if we are we don't detach (due
to threading complications), we just don't propagate buffered messages

Definition at line 87 of file publishers.py.

def rosbridge_library.internal.publishers.PublisherConsistencyListener.publish_override (   self,
  message 
)
The publisher's publish method is replaced with this publish method
which checks for timeout and if we haven't timed out, buffers outgoing
messages in preparation for new subscriptions 

Definition at line 107 of file publishers.py.

def rosbridge_library.internal.publishers.PublisherConsistencyListener.timed_out (   self)
Checks to see how much time has elapsed since the publisher was
created 

Definition at line 102 of file publishers.py.

Member Data Documentation

bool rosbridge_library.internal.publishers.PublisherConsistencyListener.attached = False
static

Definition at line 61 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.attached

Definition at line 77 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.established_time

Definition at line 75 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.lock

Definition at line 74 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.msg_buffer

Definition at line 76 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.publish

Definition at line 70 of file publishers.py.

rosbridge_library.internal.publishers.PublisherConsistencyListener.publisher

Definition at line 68 of file publishers.py.

int rosbridge_library.internal.publishers.PublisherConsistencyListener.timeout = 1
static

Definition at line 60 of file publishers.py.


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


rosbridge_library
Author(s): Jonathan Mace
autogenerated on Wed Jun 3 2020 03:55:14