Module yami :: Class ValuePublisher
[frames] | no frames]

Class ValuePublisher

object --+
         |
        ValuePublisher

Simple subscription publisher.

The subscription publisher that notifies remote listeners with published value updates.

Remote listeners can subscribe and unsubscribe at any time.

Instance Methods
 
__init__(self, user_command=None, max_queue_length=1, overflow_command=__DefaultOverflowCommand())
Constructor.
 
register_at(self, agent, object_name)
Registers the publisher at the given agent.
 
unregister(self)
Unregisters the publisher from its associated agent.
 
__call__(self, message)
 
subscribe(self, destination_target, destination_object)
Subscribes the new listener.
 
unsubscribe(self, destination_target)
Unsubscribes the given listener.
 
publish(self, value, priority=0)
Publishes the new value.
 
get_number_of_subscribers(self)
Returns the number of active subscribers.
 
get_subscribers(self)
Returns the information about all active subscribers.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Class Variables
  WAIT_FOR_PREVIOUS_MESSAGE = 1
  ABANDON_MESSAGE = 2
  ABANDON_SUBSCRIPTION = 3
Properties

Inherited from object: __class__

Method Details

__init__(self, user_command=None, max_queue_length=1, overflow_command=__DefaultOverflowCommand())
(Constructor)

 

Constructor.

Creates the subscription publisher that is not registered at any agent and that has a handler for arbitrary remote commands.

Note: The "subscribe" and "unsubscribe" messages are also forwarded to the user-provided callback, but these two messages are already processed by the publisher's implementation.

Overrides: object.__init__

subscribe(self, destination_target, destination_object)

 

Subscribes the new listener.

This function is usually called internally as a result of processing the remote "subscribe" message, but can be also used locally if the listener's location is obtained via other means.

publish(self, value, priority=0)

 

Publishes the new value.

Sends the update message to all active listeners with the given value. In case of any errors or communication problems, the problematic listener is automatically unsubscribed.

get_subscribers(self)

 

Returns the information about all active subscribers.

The first component of each vector entry is a destination target and the second component is a destination object for the given subscriber.