#include <mamacpp.h>
Name | |
---|---|
mamaBridge | loadBridge(const char * middleware) |
mamaBridge | loadBridge(const char * middleware, const char * path) |
mamaPayloadBridge | loadPayloadBridge(const char * payload) |
mamaBridge | getMiddlewareBridge(const char * middleware) |
mamaPayloadBridge | getPayloadBridge(const char * payload) |
const char * | getVersion(mamaBridge bridgeImpl) |
void | open() |
unsigned int | openCount() |
unsigned int | openCount(const char * path, const char * filename) |
void | open(const char * path, const char * filename) |
void | registerEntitlementCallbacks(MamaEntitlementCallback * callback) |
void | setProperty(const char * name, const char * value) |
const char * | getProperty(const char * name) |
void | loadDefaultProperties(void ) |
std::map< std::string, std::string > | getProperties() |
void | close() |
unsigned int | closeCount() |
void | start(mamaBridge bridgeImpl) |
void | startAll(bool isBlocking =true) |
void | startBackground(mamaBridge bridgeImpl, MamaStartCallback * callback) |
void | stop(mamaBridge bridgeImpl) |
void | stopAll(void ) |
void | enableLogging(MamaLogLevel level, FILE * logFile) |
void | logToFile(const char * file, MamaLogLevel level) |
void | disableLogging(void ) |
void | setLogLevel(MamaLogLevel level) |
MamaLogLevel | getLogLevel(void ) |
void | setLogSize(unsigned long size) |
void | setNumLogFiles(int numFiles) |
void | setLogFilePolicy(mamaLogFilePolicy policy) |
void | setAppendToLogFile(bool append) |
bool | loggingToFile(void ) |
void | setLogSizeCb(MamaLogFileCallback * callback) |
void | setApplicationName(const char * applicationName) |
void | setApplicationClassName(const char * className) |
MamaQueue * | getDefaultEventQueue(mamaBridge bridgeImpl) |
template <typename T > void |
deleteObject(T * object) |
void | setBridgeCallback(mamaBridge bridge, MamaBridgeCallback * callback) |
void | addStatsCollector(MamaStatsCollector * statsCollector) |
void | removeStatsCollector(MamaStatsCollector * statsCollector) |
class Wombat::Mama;
The [Mama](classWombat_1_1Mama.html)
class provides methods global initialization and manipulating global options.
static mamaBridge loadBridge(
const char * middleware
)
Parameters:
Return: mama_status Whether the call was successful or not.
Load the bridge specified by middleware string. If the bridge has already been loaded then the existing bridge instance will be returned.
static mamaBridge loadBridge(
const char * middleware,
const char * path
)
Parameters:
Return: mama_status Whether the call was successful or not.
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.
static mamaPayloadBridge loadPayloadBridge(
const char * payload
)
Parameters:
Return: mamaPayloadBridge The payload bridge loaded.
Load the payload bridge specified by payload string.
If the bridge has already been loaded then the existing bridge instance will be returned.
static mamaBridge getMiddlewareBridge(
const char * middleware
)
Parameters:
Return: mamaBridge The middleware bridge to be returned. Returns NULL if none available.
Return a middleware bridge which matches the middleware string.
static mamaPayloadBridge getPayloadBridge(
const char * payload
)
Parameters:
Return: mamaBridge The payload bridge to be returned. Returns NULL if none available.
Return a payload bridge which matches the payload string.
static const char * getVersion(
mamaBridge bridgeImpl
)
Returns the version of the mama binary. The version of the underlying transport is also returned in parens after the mama version.
static void open()
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.
This function is thread safe.
static unsigned int openCount()
Return: The reference count for the MAMA library after opening once. This will be non-zero and will match the amount of times a Mama::open() variant has been called.
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.
This function is thread safe.
static unsigned int openCount(
const char * path,
const char * filename
)
Parameters:
Return: The reference count for the MAMA library after opening once. This will be non-zero and will match the amount of times a Mama::open() variant has been called.
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.
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.
static void open(
const char * path,
const char * filename
)
Parameters:
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.
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.
static void registerEntitlementCallbacks(
MamaEntitlementCallback * callback
)
Parameters:
Registers the callback methods to be called whenever the user receives a disconnect request or after a dynamic entitlements update occurrs
static void setProperty(
const char * name,
const char * value
)
Parameters:
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.
static const char * getProperty(
const char * name
)
Parameters:
Return: the value of the property or NULL if unset.
Retrieve a specific property from the API.
If the property has not been set, a NULL value will be returned.
static void loadDefaultProperties(
void
)
Load in default mama.properties from the default WOMBAT_PATH directory.
static std::map< std::string, std::string > getProperties()
Return: A key value map of all configuration properties
Retrieve all configuration properties from the API.
static void close()
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 unsigned int closeCount()
Return: The reference count for the MAMA library after closing once. If this is zero then MAMA and all resources will have been freed.
Close MAMA and free all associated resources if no more references exist (e.g.if open has been called 3 times then it will require 3 calls to close in order for all resources to be freed).
This function is thread safe.
static void start(
mamaBridge bridgeImpl
)
Parameters:
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.
static void startAll(
bool isBlocking =true
)
Parameters:
Calls Mama::start for all currently loaded middleware bridges
This function is thread safe.
static void startBackground(
mamaBridge bridgeImpl,
MamaStartCallback * callback
)
Parameters:
Start processing MAMA internal events in the background. This method invokes Mama::start () in a separate thread.
static void stop(
mamaBridge bridgeImpl
)
Parameters:
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.
static void stopAll(
void
)
Stop dispatching on the default event queue for all bridges.
static void enableLogging(
MamaLogLevel level,
FILE * logFile
)
Parameters:
Enable logging and direct the output to the specified stream.
static void logToFile(
const char * file,
MamaLogLevel level
)
Parameters:
Enable logging to the specified file.
static void disableLogging(
void
)
Disable logging.
static void setLogLevel(
MamaLogLevel level
)
Parameters:
Set the logging level
static MamaLogLevel getLogLevel(
void
)
Return: the logging level
Get the logging level
static void setLogSize(
unsigned long size
)
Parameters:
Set the maxmum size of the log file (bytes) Default max size is 500 Mb
static void setNumLogFiles(
int numFiles
)
Parameters:
Set the number of rolled logfiles to keep before overwriting. Default is 10
static void setLogFilePolicy(
mamaLogFilePolicy policy
)
Parameters:
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).
static void setAppendToLogFile(
bool append
)
Parameters:
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.
static bool loggingToFile(
void
)
Return: the status of loggingToFile
Get the status of loggingToFile Returns true if logging to a file, false if not
static void setLogSizeCb(
MamaLogFileCallback * callback
)
Parameters:
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.
static void setApplicationName(
const char * applicationName
)
Parameters:
Set the mama application name This should be called before Mama.open()
static void setApplicationClassName(
const char * className
)
Parameters:
Set the mama application class This should be called before Mama.open()
static MamaQueue * getDefaultEventQueue(
mamaBridge bridgeImpl
)
Parameters:
Return: A pointer to the internal MAMA default event queue.
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.
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 void setBridgeCallback(
mamaBridge bridge,
MamaBridgeCallback * callback
)
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 void addStatsCollector(
MamaStatsCollector * statsCollector
)
Parameters:
It adds the newly created statsCollector to the statsGenerator list
static void removeStatsCollector(
MamaStatsCollector * statsCollector
)
Parameters:
It removes the statsCollector from the statsGenerator list
Updated on 2023-03-31 at 15:29:25 +0100