Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

The SUBSCRIPTION_RESPONSE WorkItem returns the result of a subscription request made by this Console.  This WorkItem is generated when the Console's create_subscription() is called in an asychronous manner, rather than pending for the result.    This WorkItem is also used to return the status of an asychronous call to the Console's refresh_subscription() method.

The get_params() method of a SUBSCRIPTION_RESPONSE  WorkItem will return an instance of the following object:

...

The SubscriptionId object must be used when the subscription is refreshed or cancelled.  The SubscriptionId must be passed to the Console's refresh_subscription() and cancel_subscription() methods.  The value of the SubscriptionId does not change over the lifetime of the subscription.

The get_handle() method returns the application handle provided to the create_subscription() method call.

...

No Format
class Console:
      <constructor>(name=<name-str>,
                    domain=(optional) domain string for console's AMQP address,
                    notifier=<class Notifier>,
                    reply_timeout=<default for all blocking calls>,
                    agent_timeout=<default timeout for agent heartbeat>,
                    subscription_duration=<default lifetime of a subscription>)

      .destroy(timeout=None): Must be called to release Console's resources.

      .add_connection(QPID Connection): Connect the console to the AMQP cloud.

      .remove_connection(conn): Remove the AMQP connection from the console.  Un-does the add_connection() operation, and
          releases any agents associated with the connection.  All blocking methods are unblocked and given a failure status.
          All outstanding asynchronous operations are cancelled without producing WorkItems.

      .get_address():
          Get the AMQP address this Console is listening to (type str).

      .find_agent( name string, [timeout] ): Query for the presence of a specific agent in the QMF domain. Returns a
          class Agent if the agent is present.  If the agent is not already known to the console, this call will send
          a query for the agent and block (with default timeout override) waiting for a response.

      .enable_agent_discovery( [Query] ): Called to enable the asynchronous Agent Discovery process. Once enabled, AGENT_ADDED
          and AGENT_DELETED work items can arrive on the WorkQueue.  If a query is supplied, it will be used to filter agent
          notifications.

      .disable_agent_discovery(): Called to disable the async Agent Discovery process enabled by calling enable_agent_discovery().

      .get_workitem_count(): Returns the count of pending WorkItems that can be retrieved.

      .get_next_workitem([timeout=0]): Obtains the next pending work item, or None if none available.

      .release_workitem(wi): Releases a WorkItem instance obtained by getNextWorkItem(). Called when the application has finished
          processing the WorkItem.

      .get_agents(): Returns a list of available agents (class Agent)

      .get_agent( name string ): Return the class Agent for the named agent, if known.

      .get_packages( [class Agent] ): Returns a list of the names of all known packages.  If an optional Agent is provided, then
          only those packages available from that Agent are returned.

      .get_classes( [class Agent] ):  Returns a list of SchemaClassIds for all available Schema.  If an optional Agent is provided,
          then the returned SchemaClassIds are limited to those Schema known to the given Agent.

      .get_schema( class SchemaClassId [, class Agent]): Return a list of all available class SchemaClass across all known agents.
          If an optional Agent is provided, restrict the returned schema to those supported by that Agent.

      .get_objects( _SchemaClassId= | _package=, _class= |
                    _object_identifier=,
                   [timeout=],
                   [list-of-class-Agent] ): perform a blocking query for QmfConsoleObjects.  Returns a list (possibly empty) of matching
           objects. The selector for the query may be either:
           * class SchemaClassId - all objects whose schema match the schema identified by _SchemaClassId parameter.
           * package/class name - all objects whose schema are contained by the named package and class.
           * the object identified by _object_identifier
           This method will block until all known agents reply, or the timeout expires. Once the timeout expires, all
           data retrieved to date is returned. If a list of agents is supplied, then the query is sent to only those agents.

      .create_subscription( agent, class Query, app_context [, reply_handle] [, timeout] ): creates a subscription to the agent
          using the given Query.  The app_context is an application-provided handle that will accompany each subscription update
          send from the agent.  Subscription updates will appear as SUBSCRIPTION_INDICATION WorkItems on the Console's work queue.
          This method may be called asynchronously by providing a reply_handle argument.  When called asynchronously, the result
          of this method call is returned in a SUBSCRIPTION_RESPONSE WorkItem.  Timeout can be used to override the console's
          default reply timeout.  When called synchronously, this method returns a class SubscriptionParams object containing
          the result of the subscription request.

      .refresh_subscription( SubscriptionId [,reply_handle] [, duration=<secs>timeout] ): (re)activatesrenews a subscription identified by SubscriptionId.  UsesThis
 the console default duration
      method may be called unlessasynchronously theby durationproviding isa explicitlyreply_handle specified.

argument. When called asynchronously, the result
           .cancel_subscription( SubscriptionId ): terminates the given subscription.
of this method call is returned in a SUBSCRIPTION_RESPONSE WorkItem.  Timeout can be used to override the console's
          default reply timeout.  When called synchronously, this method returns a class SubscriptionParams object containing
          the result of the subscription request.

      .cancel_subscription( SubscriptionId ): terminates the given subscription.

Example Console Example Console Application

The following pseudo-code performs a blocking query for a particular agent.

...

No Format
class AgentExternal(Agent):
      <constructor>(name=<name-string>,
                    domain=(optional) domain string for agent's AMQP address,
                    notifier= class Notifier,
                    heartbeat_interval=30,
                    max_msg_size=65535)
      .alloc_object_id( name="object name"): indicate to QMF that the named object is available to be managed.  Once this method returns,
          the agent will service requests from consoles referencing this data.
      .free_object_id( name="object name" ): indicate to QMF that the named object is no longer available to be managed.
      .query_response( handle=<handle from WorkItem>,
                      class QmfAgentObject): send a managed object in reply to a received query. Note that ownership of the object
          instance is returned to the caller on return from this call.
      .query_complete( handle=<handle from WorkItem>,
                      result=<status code> ):  Indicate to the agent that the application has completed processing a query request.
          Zero or more calls to the queryResponse() method should be invoked before calling query_complete().  If the query should
          fail - for example, due to authentication error - the result should be set to a non-zero error code ?TBD?.

      .subscription_response( handle=<handle from WorkItem>,
                             result=<status code>subscription_handle=<agent-provided context>,
                             subscriptionexpire_handle=<application context>): Indicate the status of a subscription request.  If result
time=<datetime>,
                             error=<QmfData>): Indicate the result of a subscription request or subscription refresh.
          If replying to isa sucessful zerosubscription, the Agent application must provide a unique subscription is accepted by the application, and an subscription handle is provided.  This handle must
  _handle.  If replying
          to a sucessful subscription refresh, the original subscription_handle must be supplied.  expire_time should be set to
        be passed tothe theUTC applicationtimestamp when the agentsubscription next unsubscribes.

Asychronous Event Model.

The Agent uses the same notification driven work-queue model as the Console. In the Agent case, the following set of WorkItem types are supported:

  • METHOD_CALL
  • QUERY
  • SUBSCRIBE
  • UNSUBSCRIBE

Note Well: In the case of an internal store agent implementation, only the METHOD_CALL work item is generated. An external store agent must support all work item types.

METHOD_CALL

The METHOD_CALL WorkItem describes a method call that must be serviced by the application on behalf of this agent.

The get_params() method of a METHOD_CALL WorkItem will return an instance of the following object:

No Format

class MethodCallParams:
expires.  If the subscription or refresh fails, the subscription_handle
       .get_name(): returns a stringshould containingbe theset nameto ofNone theand methoderror call.
may be set to an  .get_object_id(): returns the identifier for the object on which thisapplication-specific QmfData instance that describes the error.

      .subscription_indication(subscription_handle, [list of subscribed method needs to be invoked.  Returns None iff there is no associateddata]): Send a list of updated subscribed data to the Console.

      .subscription_cancel(handle=<handle from WorkItem>, subscription_handle): objectAcknowledge (a methodSubscription Cancel WorkItem.

Asychronous Event Model.

The Agent uses the same notification driven work-queue model as the Console. In the Agent case, the following set of WorkItem types are supported:

  • METHOD_CALL
  • QUERY
  • SUBSCRIBE_REQUEST
  • UNSUBSCRIBE_REQUEST

Note Well: In the case of an internal store agent implementation, only the METHOD_CALL work item is generated. An external store agent must support all work item types.

METHOD_CALL

The METHOD_CALL WorkItem describes a method call that must be serviced by the application on behalf of this agent.

The get_params() method of a METHOD_CALL WorkItem will return an instance of the following object:

No Format

class MethodCallParams:
      .get_name(): returns a string containing the name of the method call.
      .get_object_id(): returns the identifier for the object on which this
 call against the agent itself).
      .get_args(): returns a map of input arguments for the method. Arguments
         method areneeds in "name"=<value> pairsto be invoked.  Returns None if no arguments are supplied.
      .get_user_id(): returns authenticated user id of caller if present, else None.

On completion of the method call, the application must provide the result of the call to the Agent. This is done by invoking the Agent's method_response() method. The method_response() method must be passed the handle from the METHOD_CALL WorkItem.

On successful completion of a method call, any output arguments from the method call must be passed in the out_args map parameter, in name=<value> pairs. The error parameter must be set to None.

If the method call fails the application must indicate the failure by passing a QmfData instance via the error parameter. The structure of this QmfData is application-specific, and meant to provide a description of the failure to the console.

QUERY

iff there is no associated
          object (a method call against the agent itself).
      .get_args(): returns a map of input arguments for the method. Arguments
          are in "name"=<value> pairs.  Returns None if no arguments are supplied.
      .get_user_id(): returns authenticated user id of caller if present, else None.

On completion of the method call, the application must provide the result of the call to the Agent. This is done by invoking the Agent's method_response() method. The method_response() method must be passed the handle from the METHOD_CALL WorkItem.

On successful completion of a method call, any output arguments from the method call must be passed in the out_args map parameter, in name=<value> pairs. The error parameter must be set to None.

If the method call fails the application must indicate the failure by passing a QmfData instance via the error parameter. The structure of this QmfData is application-specific, and meant to provide a description of the failure to the console.

QUERY

No Format

  QUERY parameters: ( class Query,
                      user_id=<authenticated id of the user> )

The QUERY WorkItem describes a query that the application must service. The application should call the query_response() method for each object that satisfies the query. When complete, the application must call the query_complete() method. If a failure occurs, the application should indicate the error to the agent by calling the query_complete() method with a description of the error.

SUBSCRIBE_REQUEST

The SUBSCRIBE_REQUEST WorkItem provides a query that the agent application should monitor until the subscription is cancelled or expires. On receipt of this WorkItem, the application should call the Agent::subscription_response() method to acknowledge the request. Whenever the matching objects are modified, the application should call Agent::subscription_indicate() method for each updated
object, followed by a call to subscription_complete() when done. The subscription remains in effect until an UNSUBSCRIBE_REQUEST WorkItem for the subscription is received, or the subscription expires.

If this WorkItem is intended to refresh an existing subscription, the ::get_subscription_id() method call will return the subscription handle provided by the Agent to the original subscription request.  If this WorkItem is intended to create a new subscription, then the ::get_subscription_id() will return None.

TBD.....

The METHOD_CALL WorkItem describes a method call that must be serviced by the application on behalf of this agent.

The get_params() method of a METHOD_CALL WorkItem will return an instance of the following object:

No Format

class MethodCallParams:
      .get_name(): returns a string containing the name of the method call.
      .get_object_id(): returns the identifier for the object on which this
No Format

  QUERY parameters: ( class Query,
          method needs to be invoked.  Returns None iff there is  user_id=<authenticated id of the user> )

The QUERY WorkItem describes a query that the application must service. The application should call the query_response() method for each object that satisfies the query. When complete, the application must call the query_complete() method. If a failure occurs, the application should indicate the error to the agent by calling the query_complete() method with a description of the error.

SUBSCRIBE

No Format

  SUBSCRIBE parameters: ( class Query,no associated
          object (a method call against the agent itself).
      .get_args(): returns a map of input arguments for the method. Arguments
          are in "name"=<value> pairs.  Returns None if no arguments are supplied.
      .get_user_id=<authenticated(): returns authenticated user id of the user> )
 caller if present, else None.

On completion of the method call, the application must provide the result of the call to the Agent. This is done by invoking the Agent's method_response() method. The method_response() method must be passed the handle from the METHOD_CALL WorkItem.

On successful completion of a method call, any output arguments from the method call must be passed in the out_args map parameter, in name=<value> pairs. The error parameter must be set to None.

If the method call fails the application must indicate the failure by passing a QmfData instance via the error parameter. The structure of this QmfData is application-specific, and meant to provide a description of the failure to the consoleTBD
The SUBSCRIBE WorkItem provides a query that the application should
monitor until the subscription is cancelled. On receipt of this
WorkItem, the application should call the subscriptionResponse() agent
method to acknowledge the response. Whenever the matching objects are
updated, the application should call queryResponse() for each updated
object, followed by a call to queryComplete() when done. The
subscription remains in effect until an UNSUBSCRIBE WorkItem for the
subscription is received.

UNSUBSCRIBE

No Format
  UNSUBSCRIBE parameters: ( <handle associated with subscription> )

...