Classes Files

Wombat::Mama

More…

#include <mamacpp.h>

Public Functions

  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)

Detailed Description

class Wombat::Mama;

The [Mama](classWombat_1_1Mama.html) class provides methods global initialization and manipulating global options.

Public Functions Documentation

function loadBridge

static mamaBridge loadBridge(
    const char * middleware
)

Parameters:

  • impl The bridge object
  • middleware The middleware string. Can be “wmw”, “lbm” or “tibrv”.

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.

function loadBridge

static mamaBridge loadBridge(
    const char * middleware,
    const char * path
)

Parameters:

  • impl The bridge object
  • middleware The middleware string. Can be “wmw”, “lbm” or “tibrv”.
  • path The path to the bridge library

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.

function loadPayloadBridge

static mamaPayloadBridge loadPayloadBridge(
    const char * payload
)

Parameters:

  • payload The payload to be loaded.

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.

function getMiddlewareBridge

static mamaBridge getMiddlewareBridge(
    const char * middleware
)

Parameters:

  • middleware The middleware to be returned

Return: mamaBridge The middleware bridge to be returned. Returns NULL if none available.

Return a middleware bridge which matches the middleware string.

function getPayloadBridge

static mamaPayloadBridge getPayloadBridge(
    const char * payload
)

Parameters:

  • payload The payload to be returned

Return: mamaBridge The payload bridge to be returned. Returns NULL if none available.

Return a payload bridge which matches the payload string.

function getVersion

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.

function open

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.

function openCount

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.

function openCount

static unsigned int openCount(
    const char * path,
    const char * filename
)

Parameters:

  • path Fully qualified path to the directory containing the properties file
  • filename The name of the file containing MAMA properties.

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.

function open

static void open(
    const char * path,
    const char * filename
)

Parameters:

  • path Fully qualified path to the directory containing the properties file
  • filename The name of the file containing MAMA properties.

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.

function registerEntitlementCallbacks

static void registerEntitlementCallbacks(
    MamaEntitlementCallback * callback
)

Parameters:

  • callback Data structure containing the function to be invoked when disconnect request is received or after a dynamic entitlement update occurrs

Registers the callback methods to be called whenever the user receives a disconnect request or after a dynamic entitlements update occurrs

function setProperty

static void setProperty(
    const char * name,
    const char * value
)

Parameters:

  • name The name of the property
  • value The property value

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.

function getProperty

static const char * getProperty(
    const char * name
)

Parameters:

  • name The name of the property to retrieve.

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.

function loadDefaultProperties

static void loadDefaultProperties(
    void 
)

Load in default mama.properties from the default WOMBAT_PATH directory.

function getProperties

static std::map< std::string, std::string > getProperties()

Return: A key value map of all configuration properties

Retrieve all configuration properties from the API.

function close

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.

function closeCount

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.

function start

static void start(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The bridge specific structure.

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.

function startAll

static void startAll(
    bool isBlocking =true
)

Parameters:

  • isBlocking Whether to start blocking or run in background

Calls Mama::start for all currently loaded middleware bridges

This function is thread safe.

function startBackground

static void startBackground(
    mamaBridge bridgeImpl,
    MamaStartCallback * callback
)

Parameters:

  • bridgeImpl The middleware-specific bridge structure
  • callback The callback for asynchronous status.

Start processing MAMA internal events in the background. This method invokes Mama::start () in a separate thread.

function stop

static void stop(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The bridge specific structure.

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.

function stopAll

static void stopAll(
    void 
)

Stop dispatching on the default event queue for all bridges.

function enableLogging

static void enableLogging(
    MamaLogLevel level,
    FILE * logFile
)

Parameters:

  • level The level
  • logFile the log file.

Enable logging and direct the output to the specified stream.

function logToFile

static void logToFile(
    const char * file,
    MamaLogLevel level
)

Parameters:

  • file the log filename
  • level The level

Enable logging to the specified file.

function disableLogging

static void disableLogging(
    void 
)

Disable logging.

function setLogLevel

static void setLogLevel(
    MamaLogLevel level
)

Parameters:

  • level The level

Set the logging level

function getLogLevel

static MamaLogLevel getLogLevel(
    void 
)

Return: the logging level

Get the logging level

function setLogSize

static void setLogSize(
    unsigned long size
)

Parameters:

  • size the max size of file (bytes)

Set the maxmum size of the log file (bytes) Default max size is 500 Mb

function setNumLogFiles

static void setNumLogFiles(
    int numFiles
)

Parameters:

  • numFiles the max number of logfiles

Set the number of rolled logfiles to keep before overwriting. Default is 10

function setLogFilePolicy

static void setLogFilePolicy(
    mamaLogFilePolicy policy
)

Parameters:

  • policy the policy to use when max size is reached

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).

function setAppendToLogFile

static void setAppendToLogFile(
    bool append
)

Parameters:

  • append boolean flag to set append mode on or off

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.

function loggingToFile

static bool loggingToFile(
    void 
)

Return: the status of loggingToFile

Get the status of loggingToFile Returns true if logging to a file, false if not

function setLogSizeCb

static void setLogSizeCb(
    MamaLogFileCallback * callback
)

Parameters:

  • LogSizeCallback function pointer for the callback

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.

function setApplicationName

static void setApplicationName(
    const char * applicationName
)

Parameters:

  • applicationName

Set the mama application name This should be called before Mama.open()

function setApplicationClassName

static void setApplicationClassName(
    const char * className
)

Parameters:

  • className

Set the mama application class This should be called before Mama.open()

function getDefaultEventQueue

static MamaQueue * getDefaultEventQueue(
    mamaBridge bridgeImpl
)

Parameters:

  • bridgeImpl The middleware specific bridge structure.

Return: A pointer to the internal MAMA default event queue.

Get a pointer to the internal default MAMA event queue.

function deleteObject

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:

MamaMsg

function setBridgeCallback

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.

function addStatsCollector

static void addStatsCollector(
    MamaStatsCollector * statsCollector
)

Parameters:

  • statsCollector

It adds the newly created statsCollector to the statsGenerator list

function removeStatsCollector

static void removeStatsCollector(
    MamaStatsCollector * statsCollector
)

Parameters:

  • statsCollector

It removes the statsCollector from the statsGenerator list


Updated on 2023-03-31 at 15:29:25 +0100