Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved


Chapter 4 AMI API : The AMI Conversation

The AMI Conversation
This section describes in detail the three phases involved in communication between an instrumented application and its manager. The three phases of the AMI conversation are:
Figure 10 illustrates the three phases of an AMI conversation.
Figure 10 Three Stages of AMI Conversation
First AMI Phase: Discovering the Application
Discovery between the application and manager can happen in one of two ways, depending on which entity starts first.
If the Manager Starts First
If the manager starts before the application, the interaction is as shown in Figure 11.
Figure 11 AMI Discovery When the Manager Starts First
t
If the Application Starts First
If the application starts before the manager, the interaction is as shown in Figure 12.
Figure 12 AMI Discovery when the Application Starts First
At the end of the discovery phase, the manager and the application have established a connection that allows them to communicate through the inbox address. However, the manager is not yet aware of any details of the application’s interface.
Second AMI Phase: Describing the Methods
After the manager and application have exchanged announcement or discovery messages, the manager then sends a message asking the application to describe its methods. Every instrumented application must implement these methods.
Figure 13 AMI Method Description
The message sent to the manager in describe method has nested inside it a series of messages that describe each method. These are known as method descriptor messages. Each method descriptor message has messages nested inside it, which describe the types of arguments and types of returns applicable to each method. This is illustrated in Figure 13. From this description, the manager determines what structure of message to send when invoking the method, as well as how to interpret the message the application sends back.
At the end of the method description phase, the manager is aware of all message exchanges supported by the application and is ready to begin sending messages of the specified types.
Third AMI Phase: Calling the Methods
After the application has been discovered and the methods have been described, the real work takes place. Acting either on cues from a human user or by processing the rules in a rulebase, the manager sends messages to the application invoking the described methods and awaits its reply. The method invocation messages sent by the manager conform to descriptions given by the application in the describe method as to which arguments are appropriate for each method.
The application sends back a message whose contents conform to the structure the application described to the manager in the describe method.
When the manager receives the response to its method call, it presents the returned information to the human user. This scenario repeats itself over and over again until the session is terminated by either the application or the manager.
Figure 14 AMI Method Invocation
 

Copyright © Cloud Software Group, Inc. All Rights Reserved
Copyright © Cloud Software Group, Inc. All Rights Reserved