package YAMI.Value_Publishers

Public [types] [subprograms]

Types

Overflow_Handler

   type Overflow_Handler is interface;
   type Overflow_Handler_Access is access all Overflow_Handler'Class;

Callback interface type for reporting publication overflow conditions.

Overflow_Action

   type Overflow_Action is (WAIT_FOR_PREVIOUS_MESSAGE,
                            ABANDON_MESSAGE,
                            ABANDON_SUBSCRIPTION);

User action for the overflow condition.

Value_Publisher

   type Value_Publisher (<>) is limited
     new Incoming_Messages.Message_Handler with private;

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

Remote listeners can subscribe and unsubscribe at any time.

The publisher is not registered at any agent after its creation.

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


Subprograms

Overflow

   procedure Overflow (H : in out Overflow_Handler;
                       Server_Name: in String;
                       Object_Name : in String;
                       Value : YAMI.Serializables.Serializable'Class;
                       Reaction : out Overflow_Action) is abstract;

User-defined reaction to the publication overflow condition.

Make_Value_Publisher

   function Make_Value_Publisher
     (Command_Handler : Incoming_Messages.Message_Handler_Access := null;
      Max_Queue_Length : Positive := 1;
      Overflow_Handler : Overflow_Handler_Access := null)
     return Value_Publisher;

Constructor function for value publisher objects.

Subscribe

   procedure Subscribe (P : in out Value_Publisher;
                        Destination_Target : in String;
                        Destination_Object : in String);

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.

Unsubscribe

   procedure Unsubscribe (P : in out Value_Publisher;
                          Destination_Target : in String);

Unsubscribes the given listener.

Publish

   procedure Publish (P : in out Value_Publisher;
                      Value : in Serializables.Serializable'Class;
                      Priority : in Natural := 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.

Number_Of_Subscribers

   procedure Number_Of_Subscribers
     (P : in out Value_Publisher;
      Num : out Natural);

Returns the number of active subscribers.

Iterate_Subscribers_Info

   procedure Iterate_Subscribers_Info
     (P : in out Value_Publisher;
      Process : not null access procedure
      (Destination_Target : in String;
       Destination_Object : in String));

Inspects the information about all active subscribers.

Note: The iteration is performed in the mutually exclusive context so no operations affecting the same value publisher should be attempted from within the Process procedure.

Register_At

   procedure Register_At
     (P : in out Value_Publisher;
      The_Agent : Agents.Agent_Access;
      Object_Name : in String);

Unregister

   procedure Unregister (P : in out Value_Publisher);