qmf::engine::Agent Class Reference

Apache Qpid - AMQP Messaging for Java JMS, C++, Python, Ruby, and .NET | Apache Qpid Documentation

- Main Page
- Modules
- Namespaces
- Classes
- Files

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions
qmf::engine::Agent Class Reference

Agent - Protocol engine for the QMF agent. More...

`#include <qmf/engine/Agent.h>`

List of all members.

## Public Member Functions
| Agent (char *label, bool internalStore=true)
| ~Agent ()
void | setStoreDir (const char *path)
| Configure the directory path for storing persistent data.
void | setTransferDir (const char *path)
| Configure the directory path for files transferred over QMF.
void | handleRcvMessage (Message &message)
| Pass messages received from the AMQP session to the Agent engine.
bool | getXmtMessage (Message &item) const
| Get the next message to be sent to the AMQP network.
void | popXmt ()
| Remove and discard one message from the head of the transmit queue.
bool | getEvent (AgentEvent &event) const
| Get the next application event from the agent engine.
void | popEvent ()
| Remove and discard one event from the head of the event queue.
void | newSession ()
| A new AMQP session has been established for Agent communication.
void | startProtocol ()
| Start the QMF Agent protocol.
void | heartbeat ()
| This method is called periodically so the agent can supply a heartbeat.
void | methodResponse (uint32_t sequence, uint32_t status, char *text, const Value &arguments)
| Respond to a method request.
void | queryResponse (uint32_t sequence, Object &object, bool prop=true, bool stat=true)
| Send a content indication to the QMF bus.
void | queryComplete (uint32_t sequence)
| Indicate the completion of a query.
void | registerClass (SchemaObjectClass *cls)
| Register a schema class with the Agent.
void | registerClass (SchemaEventClass *cls)
| Register a schema class with the Agent.
const ObjectId * | addObject (Object &obj, uint64_t persistId)
| Give an object to the Agent for storage and management.
const ObjectId * | allocObjectId (uint64_t persistId)
| Allocate an object-id for an object that will be managed by the application.
const ObjectId * | allocObjectId (uint32_t persistIdLo, uint32_t persistIdHi)
void | raiseEvent (Event &event)
| Raise an event into the QMF network.

## Detailed Description

Agent - Protocol engine for the QMF agent.

## Constructor & Destructor Documentation

qmf::engine::Agent::Agent | ( | char * | label,
|  | bool | internalStore = `true`
| ) |  |

qmf::engine::Agent::~Agent | ( |  | ) |

## Member Function Documentation

const ObjectId* qmf::engine::Agent::addObject | ( | Object & | obj,
|  | uint64_t | persistId
| ) |  |

Give an object to the Agent for storage and management.

Once added, the agent takes responsibility for the life cycle of the object.

Parameters:

  obj | The object to be managed by the Agent.
  persistId | A unique non-zero value if the object-id is to be persistent.

Returns:
  The objectId of the managed object.

const ObjectId* qmf::engine::Agent::allocObjectId | ( | uint64_t | persistId | ) |

Allocate an object-id for an object that will be managed by the application.

Parameters:

  persistId | A unique non-zero value if the object-id is to be persistent.

Returns:
  The objectId structure for the allocated ID.

const ObjectId* qmf::engine::Agent::allocObjectId | ( | uint32_t | persistIdLo,
|  | uint32_t | persistIdHi
| ) |  |

bool qmf::engine::Agent::getEvent | ( | AgentEvent & | event | ) | const

Get the next application event from the agent engine.

Parameters:

  event | The event iff the return value is true

Returns:
  true if event is valid, false if there are no events to process

bool qmf::engine::Agent::getXmtMessage | ( | Message & | item | ) | const

Get the next message to be sent to the AMQP network.

Parameters:

  item | The Message structure describing the message to be produced.

Returns:
  true if the Message is valid, false if there are no messages to send.

void qmf::engine::Agent::handleRcvMessage | ( | Message & | message | ) |

Pass messages received from the AMQP session to the Agent engine.

Parameters:

  message | AMQP messages received on the agent session.

void qmf::engine::Agent::heartbeat | ( |  | ) |

This method is called periodically so the agent can supply a heartbeat.

void qmf::engine::Agent::methodResponse | ( | uint32_t | sequence,
|  | uint32_t | status,
|  | char * | text,
|  | const Value & | arguments
| ) |  |

Respond to a method request.

Parameters:

  sequence | The sequence number from the method request event.
  status | The method's completion status.
  text | Status text ("OK" or an error message)
  arguments | The list of output arguments from the method call.

void qmf::engine::Agent::newSession | ( |  | ) |

A new AMQP session has been established for Agent communication.

void qmf::engine::Agent::popEvent | ( |  | ) |

Remove and discard one event from the head of the event queue.

void qmf::engine::Agent::popXmt | ( |  | ) |

Remove and discard one message from the head of the transmit queue.

void qmf::engine::Agent::queryComplete | ( | uint32_t | sequence | ) |

Indicate the completion of a query.

This is not used for SYNC_START requests.

Parameters:

  sequence | The sequence number of the GET request.

void qmf::engine::Agent::queryResponse | ( | uint32_t | sequence,
|  | Object & | object,
|  | bool | prop = `true`,
|  | bool | stat = `true`
| ) |  |

Send a content indication to the QMF bus.

This is only needed for objects that are managed by the application. This is *NOT* needed for objects managed by the Agent (inserted using addObject).

Parameters:

  sequence | The sequence number of the GET request or the SYNC_START request.
  object | The object (annotated with "changed" flags) for publication.
  prop | If true, changed object properties are transmitted.
  stat | If true, changed object statistics are transmitted.

void qmf::engine::Agent::raiseEvent | ( | Event & | event | ) |

Raise an event into the QMF network.

Parameters:

  event | The event object for the event to be raised.

void qmf::engine::Agent::registerClass | ( | SchemaObjectClass * | cls | ) |

Register a schema class with the Agent.

Parameters:

  cls | A SchemaObejctClass object that defines data managed by the agent.

void qmf::engine::Agent::registerClass | ( | SchemaEventClass * | cls | ) |

Register a schema class with the Agent.

Parameters:

  cls | A SchemaEventClass object that defines events sent by the agent.

void qmf::engine::Agent::setStoreDir | ( | const char * | path | ) |

Configure the directory path for storing persistent data.

Parameters:

  path | Null-terminated string containing a directory path where files can be created, written, and read. If NULL, no persistent storage will be attempted.

void qmf::engine::Agent::setTransferDir | ( | const char * | path | ) |

Configure the directory path for files transferred over QMF.

Parameters:

  path | Null-terminated string containing a directory path where files can be created, deleted, written, and read. If NULL, file transfers shall not be permitted.

void qmf::engine::Agent::startProtocol | ( |  | ) |

Start the QMF Agent protocol.

This should be invoked after a SETUP_COMPLETE event is received from the Agent engine.

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

- qmf/engine/Agent.h