Qpid Management Framework  0.22
qmf::AgentSession Class Reference

#include <AgentSession.h>

Inheritance diagram for qmf::AgentSession:
Collaboration diagram for qmf::AgentSession:

List of all members.

Public Member Functions

QMF_EXTERN AgentSession (AgentSessionImpl *impl=0)
QMF_EXTERN AgentSession (const AgentSession &)
QMF_EXTERN AgentSessionoperator= (const AgentSession &)
QMF_EXTERN ~AgentSession ()
QMF_EXTERN AgentSession (qpid::messaging::Connection &conn, const std::string &options="")
QMF_EXTERN void setDomain (const std::string &domain)
QMF_EXTERN void setVendor (const std::string &vendor)
QMF_EXTERN void setProduct (const std::string &product)
QMF_EXTERN void setInstance (const std::string &instance)
QMF_EXTERN void setAttribute (const std::string &key, const qpid::types::Variant &value)
QMF_EXTERN const std::string & getName () const
QMF_EXTERN void open ()
QMF_EXTERN void close ()
QMF_EXTERN bool nextEvent (AgentEvent &outEvent, qpid::messaging::Duration timeout=qpid::messaging::Duration::FOREVER)
QMF_EXTERN int pendingEvents () const
QMF_EXTERN void registerSchema (Schema &schema)
QMF_EXTERN DataAddr addData (Data &data, const std::string &name="", bool persistent=false)
QMF_EXTERN void delData (const DataAddr &dataAddr)
QMF_EXTERN void authAccept (AgentEvent &event)
QMF_EXTERN void authReject (AgentEvent &event, const std::string &diag="")
QMF_EXTERN void raiseException (AgentEvent &event, const std::string &errorText)
QMF_EXTERN void raiseException (AgentEvent &event, const Data &errorData)
QMF_EXTERN void response (AgentEvent &event, const Data &responseData)
QMF_EXTERN void complete (AgentEvent &event)
QMF_EXTERN void methodSuccess (AgentEvent &event)
QMF_EXTERN void raiseEvent (const Data &data)
QMF_EXTERN void raiseEvent (const Data &data, int severity)


class qmf::PrivateImplRef< AgentSession >
struct AgentSessionImplAccess

Constructor & Destructor Documentation

QMF_EXTERN qmf::AgentSession::AgentSession ( AgentSessionImpl *  impl = 0)
QMF_EXTERN qmf::AgentSession::AgentSession ( const AgentSession )
QMF_EXTERN qmf::AgentSession::~AgentSession ( )
QMF_EXTERN qmf::AgentSession::AgentSession ( qpid::messaging::Connection &  conn,
const std::string &  options = "" 

AgentSession A session that runs over an AMQP connection for QMF agent operation.

connection- An opened qpid::messaging::Connection
options- An optional string containing options

The options string is of the form "{key:value,key:value}". The following keys are supported:

interval:N - Heartbeat interval in seconds [default: 60] external:{True,False} - Use external data storage (queries and subscriptions are pass-through) [default: False] allow-queries:{True,False} - If True: automatically allow all queries [default] If False: generate an AUTH_QUERY event to allow per-query authorization allow-methods:{True,False} - If True: automatically allow all methods [default] If False: generate an AUTH_METHOD event to allow per-method authorization max-subscriptions:N - Maximum number of concurrent subscription queries permitted [default: 64] min-sub-interval:N - Minimum publish interval (in milliseconds) permitted for a subscription [default: 3000] sub-lifetime:N - Lifetime (in seconds with no keepalive) for a subscription [default: 300] public-events:{True,False} - If True: QMF events are sent to the topic exchange [default] If False: QMF events are only sent to authorized subscribers listen-on-direct:{True,False} - If True: Listen on legacy direct-exchange address for backward compatibility [default] If False: Listen only on the routable direct address strict-security:{True,False} - If True: Cooperate with the broker to enforce strict access control to the network

  • If False: Operate more flexibly with regard to use of messaging facilities [default] max-thread-wait-time:N - Time (in seconds) the session thread will wait for messages from the network between periodic background processing passes. [default: 5] Must not be greater than 'interval'. Larger numbers will cause fewer wake-ups but will increase the time it takes to shut down the process. This setting will not affect the agent's response time for queries or method invocation.

Member Function Documentation

QMF_EXTERN DataAddr qmf::AgentSession::addData ( Data data,
const std::string &  name = "",
bool  persistent = false 

Add data to be managed internally by the agent. If the option external:True is selected, this call should not be used.

data- The data object being managed by the agent.
name- A name unique to this object to be used to address the object. If left default, a unique name will be assigned by the agent.
persistent- Set this to true if the data object is to be considered persistent across different sessions. If persistent, it is the agent application's responsibility to ensure the name is the same each time it is added.
QMF_EXTERN void qmf::AgentSession::authAccept ( AgentEvent event)

The following methods are used to respond to events received in nextEvent.

authAccept - Accept an authorization request. authReject - Reject/forbid an authorization request. raiseException - indicate failure of an operation (i.e. query or method call). response - Provide data in response to a query (only for option: external:True) complete - Indicate that the response to a query is complete (external:True only) methodSuccess - Indicate the successful completion of a method call.

QMF_EXTERN void qmf::AgentSession::authReject ( AgentEvent event,
const std::string &  diag = "" 
QMF_EXTERN void qmf::AgentSession::close ( )

Close the session. Once closed, the session no longer communicates on the messaging network.

QMF_EXTERN void qmf::AgentSession::complete ( AgentEvent event)
QMF_EXTERN void qmf::AgentSession::delData ( const DataAddr dataAddr)

Delete data from internal agent management.

QMF_EXTERN const std::string& qmf::AgentSession::getName ( ) const

Get the identifying name of the agent.

QMF_EXTERN void qmf::AgentSession::methodSuccess ( AgentEvent event)
QMF_EXTERN bool qmf::AgentSession::nextEvent ( AgentEvent outEvent,
qpid::messaging::Duration  timeout = qpid::messaging::Duration::FOREVER 

Get the next event from the agent session. Events represent actions that must be acted upon by the agent application. This method blocks for up to the timeout if there are no events to be handled. This method will typically be the focus of the agent application's main execution loop. If the timeout is set to Duration::IMMEDIATE, the call will not block.

QMF_EXTERN void qmf::AgentSession::open ( )

Open the agent session. After opening the session, the domain, identifying strings, and attributes cannot be changed.

QMF_EXTERN AgentSession& qmf::AgentSession::operator= ( const AgentSession )
QMF_EXTERN int qmf::AgentSession::pendingEvents ( ) const

Return the number of events pending for nextEvent. This method will never block.

QMF_EXTERN void qmf::AgentSession::raiseEvent ( const Data data)

Raise an event to be sent into the QMF network.

data- A data object that contains the event contents.
severity- Explicit severity (from qmf/SchemaTypes.h). If omitted, the severity is set to the default severity for the data's schema. If the data has no schema, the severity defaults to SEV_NOTICE.
QMF_EXTERN void qmf::AgentSession::raiseEvent ( const Data data,
int  severity 
QMF_EXTERN void qmf::AgentSession::raiseException ( AgentEvent event,
const std::string &  errorText 
QMF_EXTERN void qmf::AgentSession::raiseException ( AgentEvent event,
const Data errorData 
QMF_EXTERN void qmf::AgentSession::registerSchema ( Schema schema)

Register a schema to be exposed by this agent.

QMF_EXTERN void qmf::AgentSession::response ( AgentEvent event,
const Data responseData 
QMF_EXTERN void qmf::AgentSession::setAttribute ( const std::string &  key,
const qpid::types::Variant &  value 

setAttribute - Set an arbitrary attribute for this agent. The attributes are not used to uniquely identify the agent but can be used as a search criteria when looking for agents. This must be called prior to opening the agent session.

QMF_EXTERN void qmf::AgentSession::setDomain ( const std::string &  domain)

setDomain - Change the QMF domain that this agent will operate in. If this is not called, the domain will be "default". Agents in a domain can be seen only by consoles in the same domain. This must be called prior to opening the agent session.

QMF_EXTERN void qmf::AgentSession::setInstance ( const std::string &  instance)
QMF_EXTERN void qmf::AgentSession::setProduct ( const std::string &  product)
QMF_EXTERN void qmf::AgentSession::setVendor ( const std::string &  vendor)

Set identifying attributes of this agent. setVendor - Set the vendor string setProduct - Set the product name string setInstance - Set the unique instance name (if not set, a UUID will be assigned) These must be called prior to opening the agent session.

Friends And Related Function Documentation

friend struct AgentSessionImplAccess [friend]
friend class qmf::PrivateImplRef< AgentSession > [friend]

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