Listener Class

The Listener object is used to listen for connections from Managers. The application should only create one Listener which must exist for the lifetime of the application.

Once a Listener has been created, Event, Meter, Accumulator, and Duration objects can be used by the Listener to automatically gather performance data. Container objects may also be created to group together the performance gathering objects and Custom Messages may be used to communicate with the Managers.

For more information about creating and using the Listener, see the topics in the section Getting Started with the System Manager Listener C++ API.

Syntax
Listener listener(const char *appName, const char *appVersion, [optional] PCHcallable *heartbeatObject, [optional] bool ListenerOn);
Listener listener(const wchar_t *appName, const wchar_t *appVersion, [optional] PCHcallable *heartbeatObject, [optional] bool ListenerOn);
Parameters
appName - [in] Required pointer to a string, which provides the name of the application to be monitored for performance. The string should consist of UTF-8 or Unicode characters, which may contain any printable characters excluding the newline character.
appVersion - [in] Required pointer to a string, which specifies the version of the application. The string should consist of UTF-8 or Unicode characters, which may contain any printable characters excluding the newline character.
heartbeatObject - [in] Optional PCHcallable object (default is null), which provides an object that the Listener can call back to when it receives Custom Messages from a connected Manager. When this parameter is set to null, a default PCHcallable object is automatically created by the constructor for the Listener.
ListenerOn - [in] Optional Boolean value (default is true), which indicates whether the Listener should actually be enabled or "turned on". When set to false, the Listener is created yet not enabled. As a result, the Listener will not start its background thread, listen on its port, or write to log files. However, even when the Listener is not enabled, objects are still created and can be accessed in the usual manner from the Listener APIs.
Example
Listener *listener = new Listener("sampleApp", "4.0", NULL, true);
Member Functions
durationFactory - Creates a Duration object at the top-level of the Listener.
lookupContainer - Creates a Container object at the top-level of the Listener, the member functions of which can be used to create subordinate Event objects and Meter objects.
lookupEvent - Creates an Event object at the top-level of the Listener.
recordCustomMessage - Sends a Custom Message to all connected Managers.
setInterval - Controls the aggregation interval.
shutdown - Flushes any buffered data out to all connected Managers, to ensure the data is not lost when the application exits.
See Also
Accumulator Class
Container Class
Duration Class
Event Class
Meter Class
PCHcallable Class