The Mama
class provides methods global initialization and manipulating global options.
More...
#include <mamacpp.h>
Static Public Member Functions | |
static mamaBridge | loadBridge (const char *middleware) |
Load the bridge specified by middleware string. | |
static mamaBridge | loadBridge (const char *middleware, const char *path) |
Load the bridge specified by middleware string using the path specified by the user. | |
static const char * | getVersion (mamaBridge bridgeImpl) |
Returns the version of the mama binary. | |
static void | open () |
Initialize MAMA. | |
static void | open (const char *path, const char *filename) |
Initialize MAMA. | |
static void | setProperty (const char *name, const char *value) |
Set a specific property for the API. | |
static const char * | getProperty (const char *name) |
Retrieve a specific property from the API. | |
static void | close () |
Close MAMA and free all associated resource. | |
static void | start (mamaBridge bridgeImpl) |
Start processing messages on the internal queue. | |
static void | startBackground (mamaBridge bridgeImpl, MamaStartCallback *callback) |
Start processing MAMA internal events in the background. | |
static void | stop (mamaBridge bridgeImpl) |
Stop dispatching on the default event queue for the specified bridge. | |
static void | stopAll (void) |
Stop dispatching on the default event queue for all bridges. | |
static void | enableLogging (MamaLogLevel level, FILE *logFile) |
Enable logging and direct the output to the specified stream. | |
static void | logToFile (const char *file, MamaLogLevel level) |
Enable logging to the specified file. | |
static void | disableLogging (void) |
Disable logging. | |
static void | setLogLevel (MamaLogLevel level) |
Set the logging level. | |
static MamaLogLevel | getLogLevel (void) |
Get the logging level. | |
static void | setLogSize (unsigned long size) |
Set the maxmum size of the log file (bytes) Default max size is 500 Mb. | |
static void | setNumLogFiles (int numFiles) |
Set the number of rolled logfiles to keep before overwriting. | |
static void | setLogFilePolicy (mamaLogFilePolicy policy) |
Set the policy regarding how to handle files when Max file size is reached. | |
static void | setAppendToLogFile (bool append) |
Set the mode when opening an existing log file. | |
static bool | loggingToFile (void) |
Get the status of loggingToFile Returns true if logging to a file, false if not. | |
static void | setLogSizeCb (MamaLogFileCallback *callback) |
Set a callback for when the max log size is reached. | |
static void | setApplicationName (const char *applicationName) |
Set the mama application name This should be called before Mama.open() | |
static void | setApplicationClassName (const char *className) |
Set the mama application class This should be called before Mama.open() | |
static MamaQueue * | getDefaultEventQueue (mamaBridge bridgeImpl) |
Get a pointer to the internal default MAMA event queue. | |
template<typename T > | |
static void | deleteObject (T *object) |
Allow the MAMA API free memory for any objects which have been allocated by the API but responsibility for deleting has been handed to the application code. | |
static void | setBridgeCallback (mamaBridge bridge, MamaBridgeCallback *callback) |
Set a MamaBridgeMessageCallback to be invoked whenever information messages are logged at the bridge level. | |
static void | addStatsCollector (MamaStatsCollector *statsCollector) |
It adds the newly created statsCollector to the statsGenerator list. | |
static void | removeStatsCollector (MamaStatsCollector *statsCollector) |
It removes the statsCollector from the statsGenerator list. |
The Mama
class provides methods global initialization and manipulating global options.
|
static |
Load the bridge specified by middleware string.
If the bridge has already been loaded then the existing bridge instance will be returned.
impl | The bridge object |
middleware | The middleware string. Can be "wmw", "lbm" or "tibrv". |
|
static |
Load the bridge specified by middleware string using the path specified by the user.
If the bridge has already been loaded then the existing bridge instance will be returned.
impl | The bridge object |
middleware | The middleware string. Can be "wmw", "lbm" or "tibrv". |
path | The path to the bridge library |
|
static |
Returns the version of the mama binary.
The version of the underlying transport is also returned in parens after the mama version.
|
static |
Initialize MAMA.
MAMA employs a reference count to track multiple calls to Mama::open() and Mama::close(). The count is incremented every time Mama::open() is called and decremented when Mama::close() is called. The resources are not actually released until the count reaches zero.
If entitlements are enabled for the library, the available entitlement server names are read from the entitlement.servers property in the mama.properties file located in the $WOMBAT_PATH directory.
This function is thread safe.
|
static |
Initialize MAMA.
Allows users of the API to override the default behaviour of Mama.open() where a file mama.properties is required to be located in the directory specified by $WOMBAT_PATH.
The properties file must have the same structure as a standard mama.properties file.
If null is passed as the path the API will look for the properties file on the $WOMBAT_PATH.
If null is passed as the filename the API will look for the default filename of mama.properties.
[in] | path | Fully qualified path to the directory containing the properties file |
[in] | filename | The name of the file containing MAMA properties. |
|
static |
Set a specific property for the API.
If the property being set has already been given a value from a properties file that value will be replaced.
See the example mama.properties provided with the distribution for examples of property formatting. The properties set via this function should be formatted in the same manner as those specified in mama.properties.
The strings passed to the function are copied.
name | The name of the property |
value | The property value |
|
static |
Retrieve a specific property from the API.
If the property has not been set, a NULL value will be returned.
name | The name of the property to retrieve. |
|
static |
Close MAMA and free all associated resource.
MAMA employs a reference count to track multiple calls to Mama::open() and Mama::close(). The count is incremented every time Mama::open() is called and decremented when Mama::close() is called. The resources are not actually released until the count reaches zero.
This function is thread safe.
|
static |
Start processing messages on the internal queue.
This starts Mama's internal throttle, refresh logic, and other internal Mama processes as well as dispatching messages from the internal queue.
Mama::start( ) blocks until an invocation of Mama::stop() occurs.
MAMA employs a reference count to track multiple calls to Mama::start() and Mama::stop(). The count is incremented every time Mama::start() is called and decremented when Mama::stop() is called. The first Mama::start() call does not unblock until the count reaches zero.
This function is thread safe.
[in] | bridgeImpl | The bridge specific structure. |
|
static |
Start processing MAMA internal events in the background.
This method invokes Mama::start () in a separate thread.
[in] | bridgeImpl | The middleware-specific bridge structure |
[in] | callback | The callback for asynchronous status. |
|
static |
Stop dispatching on the default event queue for the specified bridge.
MAMA employs a reference count to track multiple calls to Mama::start() and Mama::stop(). The count is incremented every time Mama::start() is called and decremented when Mama::stop() is called. The first Mama::start() call does not unblock until the count reaches zero.
This function is thread safe.
[in] | bridgeImpl | The bridge specific structure. |
|
static |
Stop dispatching on the default event queue for all bridges.
|
static |
Enable logging and direct the output to the specified stream.
level | The level |
logFile | the log file. |
|
static |
Enable logging to the specified file.
file | the log filename |
level | The level |
|
static |
Disable logging.
|
static |
Set the logging level.
level | The level |
|
static |
Get the logging level.
|
static |
Set the maxmum size of the log file (bytes) Default max size is 500 Mb.
size | the max size of file (bytes) |
|
static |
Set the number of rolled logfiles to keep before overwriting.
Default is 10
numFiles | the max number of logfiles |
|
static |
Set the policy regarding how to handle files when Max file size is reached.
Default is LOGFILE_UNBOUNDED - uses a single logfile unlimited in size. Other policies are: LOGFILE_ROLL - keeps N logfiles specified with setNumLogFiles(N). LOGFILE_OVERWRITE - uses a single logfile limited in size. LOGFILE_USER - if user has registered a callback it will be calledt. Otherwise the file will roll or get overwritten depending onthe value specified with setNumLogFiles(N).
policy | the policy to use when max size is reached |
|
static |
Set the mode when opening an existing log file.
setAppendToLogFile(true) will add data to the end of an existing file. Default is false which will overwrite any existing data in the file.
append | boolean flag to set append mode on or off |
|
static |
Get the status of loggingToFile Returns true if logging to a file, false if not.
|
static |
Set a callback for when the max log size is reached.
This will only be called if the policy has been set to LOGFILE_USER.
LogSizeCallback | function pointer for the callback |
|
static |
Set the mama application name This should be called before Mama.open()
applicationName |
|
static |
Set the mama application class This should be called before Mama.open()
className |
|
static |
Get a pointer to the internal default MAMA event queue.
bridgeImpl | The middleware specific bridge structure. |
|
static |
Allow the MAMA API free memory for any objects which have been allocated by the API but responsibility for deleting has been handed to the application code.
This enables users of the API to provide alternate memory management implementations which may result in difficulties when deleting objects allocated internally by the MAMA API.
E.g. Detaching the MamaMsg in a subscription callback.
Currently supported types:
|
static |
Set a MamaBridgeMessageCallback to be invoked whenever information messages are logged at the bridge level.
Information messages vary depenging on the underlying middleware. Currently only supported for LBM.
|
static |
It adds the newly created statsCollector to the statsGenerator list.
statsCollector |
|
static |
It removes the statsCollector from the statsGenerator list.
statsCollector |