YAMI4 Python Library 2.0.0
Messaging Solution for Distributed Systems
Loading...
Searching...
No Matches
Classes | Public Member Functions | Static Public Attributes | List of all members
yami.ValuePublisher Class Reference
Inheritance diagram for yami.ValuePublisher:

Classes

class  __DefaultOverflowCommand
 
class  __SubscriptionInfo
 

Public Member Functions

def __init__ (self, user_command=None, max_queue_length=1, overflow_command=__DefaultOverflowCommand())
 
def register_at (self, agent, object_name)
 
def unregister (self)
 
def __call__ (self, message)
 
def subscribe (self, destination_target, destination_object)
 
def unsubscribe (self, destination_target)
 
def publish (self, value, priority=0)
 
def get_number_of_subscribers (self)
 
def get_subscribers (self)
 

Static Public Attributes

int WAIT_FOR_PREVIOUS_MESSAGE = 1
 
int ABANDON_MESSAGE = 2
 
int ABANDON_SUBSCRIPTION = 3
 

Detailed Description

Simple subscription publisher.

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

Remote listeners can subscribe and unsubscribe at any time.

Constructor & Destructor Documentation

◆ __init__()

def yami.ValuePublisher.__init__ (   self,
  user_command = None,
  max_queue_length = 1,
  overflow_command = __DefaultOverflowCommand() 
)
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.

Member Function Documentation

◆ get_number_of_subscribers()

def yami.ValuePublisher.get_number_of_subscribers (   self)
Returns the number of active subscribers.

◆ get_subscribers()

def yami.ValuePublisher.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.

◆ publish()

def yami.ValuePublisher.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.

◆ register_at()

def yami.ValuePublisher.register_at (   self,
  agent,
  object_name 
)
Registers the publisher at the given agent.

◆ subscribe()

def yami.ValuePublisher.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.

◆ unregister()

def yami.ValuePublisher.unregister (   self)
Unregisters the publisher from its associated agent.

◆ unsubscribe()

def yami.ValuePublisher.unsubscribe (   self,
  destination_target 
)
Unsubscribes the given listener.

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