OpenMAMA
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
mama.h File Reference
#include "mama/config.h"
#include <mama/log.h>
#include <mama/error.h>
#include <mama/types.h>
#include <mama/datetime.h>
#include <mama/servicelevel.h>
#include <mama/status.h>
#include <mama/msgstatus.h>
#include <mama/msgtype.h>
#include <mama/msgfield.h>
#include <mama/dictionary.h>
#include <mama/transport.h>
#include <mama/msg.h>
#include <mama/middleware.h>
#include <mama/price.h>
#include <mama/publisher.h>
#include <mama/reservedfields.h>
#include <mama/inbox.h>
#include <mama/timer.h>
#include <mama/queue.h>
#include <mama/senderId.h>
#include <mama/symbolmap.h>
#include <mama/symbolmapfile.h>
#include <mama/timezone.h>
#include <mama/source.h>
#include <mama/subscriptiontype.h>
#include <mama/quality.h>
#include <mama/ft.h>

Go to the source code of this file.

Macros

#define MAMA_OPEN_MD   ((uint32_t)(0x00000001))
#define MAMA_OPEN_PUB_SUB   ((uint32_t)(0x00000002))
#define MAMA_DEFAULT_THROTTLE_RATE   500
#define MAMA_DEFAULT_RECAP_THROTTLE_RATE   250
#define MAMA_DEFAULT_RETRIES   2
#define MAMA_DEFAULT_TIMEOUT   30.0f
#define MAMA_MAX_SYMBOL_LEN   128
#define MAMA_MAX_SOURCE_LEN   64
#define MAMA_MAX_TRANSPORT_LEN   64
#define MAMA_LINK_BRIDGE(implIdentifier, impl)
#define MAMA_CREATE_BRIDGE(implIdentifier, impl)

Typedefs

typedef void *MAMAExpDLL
mama_status 
mama_startBackgroundEx (mamaBridge bridgeImpl, mamaStopCBEx callback, void *closure)
 Start Mama in the background, with extended parameters.
typedef const char * message

Functions

mama_status mama_setDefaultPayload (char id)
 The Mama data type provides methods global initialization and manipulating global options.
MAMAExpDLL mama_status mama_loadBridge (mamaBridge *impl, const char *middleware)
 Load the bridge specified by middleware string.
MAMAExpDLL mama_status mama_loadPayloadBridge (mamaPayloadBridge *bridge, const char *payloadName)
MAMAExpDLL mama_status mama_loadBridgeWithPath (mamaBridge *impl, const char *middleware, const char *path)
 Load the bridge specified by middleware string using the path specified by the user.
MAMAExpDLL mama_status mama_open (void)
 mama_status mama_open (void)
MAMAExpDLL mama_status mama_openWithProperties (const char *path, const char *filename)
 Initialize MAMA.
MAMAExpDLL mama_status mama_setProperty (const char *name, const char *value)
 Set a specific property for the API.
MAMAExpDLL mama_status mama_setPropertiesFromFile (const char *path, const char *filename)
 Load a set of properties through the API.
MAMAExpDLL const char * mama_getProperty (const char *name)
 Retrieve a specific property from the API.
MAMAExpDLL mama_status mama_close (void)
 Close MAMA and free all associated resource.
MAMAExpDLL const char * mama_getVersion (mamaBridge bridgeImpl)
 Return the version information for the library.
MAMAExpDLL mama_status mama_start (mamaBridge bridgeImpl)
 Start processing messages on the internal queue.
typedef void (MAMACALLTYPE *mamaStartCB)(mama_status status)
 The callback invoked if an error occurs calling mama_startBackground() or when mama_startBackground() exits normally in which case status will be MAMA_STATUS_OK.
MAMAExpDLL mama_status mama_startBackground (mamaBridge bridgeImpl, mamaStartCB callback)
 Start Mama in the background.
MAMAExpDLL mama_status mama_stop (mamaBridge bridgeImpl)
 Stop dispatching on the default event queue for the specified bridge.
MAMAExpDLL mama_status mama_stopAll (void)
 Stop dispatching on the default event queue for all bridges.
MAMAExpDLL mama_status mama_setApplicationName (const char *applicationName)
 mama_setApplicationName - sets the mama application name This should be called before mama_open
MAMAExpDLL mama_status mama_setApplicationClassName (const char *className)
 mama_setApplicationClass - sets the mama class name This should be called before mama_open
MAMAExpDLL mama_status mama_getApplicationName (const char **applicationName)
 mama_getApplicationName - gets the mama application name
MAMAExpDLL mama_status mama_getApplicationClassName (const char **className)
 mama_getApplicationClass - sets the mama class name
MAMAExpDLL mama_status mama_getUserName (const char **userName)
 mama_getUserName - gets the user name
MAMAExpDLL mama_status mama_getHostName (const char **hostName)
 mama_getHostName - gets the host name
MAMAExpDLL mama_status mama_getIpAddress (const char **ipAddress)
 mama_getIpAddressName - gets the IP Address
MAMAExpDLL mama_status mama_getDefaultEventQueue (mamaBridge bridgeImpl, mamaQueue *defaultQueue)
 Get a reference to the internal default event queue in use for the specified middleware.
MAMAExpDLL void mama_setLastError (mamaError error)
 Set the last error to occur in Mama.
MAMAExpDLL mamaError mama_getLastErrorCode (void)
 Get the code of the last error to have occurred in Mama.
MAMAExpDLL const char * mama_getLastErrorText (void)
 Get the text of the last error to have occurred in Mama.
MAMAExpDLL mama_status mama_setBridgeInfoCallback (mamaBridge bridgeImpl, bridgeInfoCallback callback)
 Sets a callback to be invoked whenever an information message is logged at the bridge level.
MAMAExpDLL mama_status mama_addStatsCollector (mamaStatsCollector statsCollector)
 Add a user stats collector.
MAMAExpDLL mama_status mama_removeStatsCollector (mamaStatsCollector statsCollector)
 Remove a user stats collector.

Variables

typedef mamaBridge

Macro Definition Documentation

#define MAMA_OPEN_MD   ((uint32_t)(0x00000001))
#define MAMA_OPEN_PUB_SUB   ((uint32_t)(0x00000002))
#define MAMA_DEFAULT_THROTTLE_RATE   500
#define MAMA_DEFAULT_RECAP_THROTTLE_RATE   250
#define MAMA_DEFAULT_RETRIES   2
#define MAMA_DEFAULT_TIMEOUT   30.0f
#define MAMA_MAX_SYMBOL_LEN   128
#define MAMA_MAX_SOURCE_LEN   64
#define MAMA_MAX_TRANSPORT_LEN   64
#define MAMA_LINK_BRIDGE (   implIdentifier,
  impl 
)
Value:
do \
{ \
implIdentifier ## Bridge_createImpl (impl); \
} \
while(0) \
#define MAMA_CREATE_BRIDGE (   implIdentifier,
  impl 
)
Value:
do \
{ \
if (MAMA_LINK_##implIdentifier) \
{ \
implIdentifier##Bridge_createImpl (impl); \
} \
else \
{ \
mama_loadBridge (impl, "##implIdentifier##"); \
} \
} \
while(0) \

Typedef Documentation

typedef void* MAMAExpDLL mama_status mama_startBackgroundEx(mamaBridge bridgeImpl, mamaStopCBEx callback, void *closure)

Start Mama in the background, with extended parameters.

This method performs the same functionality as mama_startBackground accept it provides the facility to pass in a closure. The C++ wrapper layer uses this version of the function, and stores the MamaStartCallback object in the closure.

Parameters
[in]bridgeImplThe bridge specific structure.
[in]callbackThe extended callback for asynchronous status.
Returns
MAMA_STATUS_OK if successful.
typedef const char* message

Function Documentation

mama_status mama_setDefaultPayload ( char  id)

The Mama data type provides methods global initialization and manipulating global options.

Related Mama functions also provide means for creating transports, dictionaries, and subscriptions.

MAMAExpDLL mama_status mama_loadBridge ( mamaBridge impl,
const char *  middleware 
)

Load the bridge specified by middleware string.

If the bridge has already been loaded then the existing bridge instance will be returned.

Parameters
implThe bridge object
middlewareThe middleware string. Can be "wmw", "lbm" or "tibrv".
Returns
mama_status Whether the call was successful or not.
MAMAExpDLL mama_status mama_loadPayloadBridge ( mamaPayloadBridge bridge,
const char *  payloadName 
)
MAMAExpDLL mama_status mama_loadBridgeWithPath ( mamaBridge impl,
const char *  middleware,
const char *  path 
)

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.

Parameters
implThe bridge object
middlewareThe middleware string. Can be "wmw", "lbm" or "tibrv".
pathThe path to the bridge library
Returns
mama_status Whether the call was successful or not.
MAMAExpDLL mama_status mama_open ( void  )

mama_status mama_open (void)

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.

MAMAExpDLL mama_status mama_openWithProperties ( const char *  path,
const char *  filename 
)

Initialize MAMA.

Allows users of the API to override the default behavior 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.

Parameters
pathFully qualified path to the directory containing the properties file
filenameThe name of the file containing MAMA properties.
Returns
mama_status Whether the call was successful or not.
MAMAExpDLL mama_status mama_setProperty ( const char *  name,
const char *  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.

Parameters
nameThe name of the property being set.
valueThe value of the property being set.
Returns
MAMA_STATUS_NULL_ARG is either name or value is null. MAMA_STATUS_OK if the function completed successfully.
MAMAExpDLL mama_status mama_setPropertiesFromFile ( const char *  path,
const char *  filename 
)

Load a set of properties through the API.

If the property being set has already been given a value from a properties file that value will be replaced.

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.

Parameters
pathFully qualified path to the directory containing the properties file
filenameThe name of the file containing properties.
Returns
MAMA_STATUS_NULL_ARG is either name or value is null. MAMA_STATUS_OK if the function completed successfully.
MAMAExpDLL const char* mama_getProperty ( const char *  name)

Retrieve a specific property from the API.

If the property has not been set, a NULL value will be returned.

Parameters
nameThe name of the property to retrieve.
Returns
the value of the property or NULL if unset.
MAMAExpDLL mama_status mama_close ( void  )

Close MAMA and free all associated resource.

MAMAExpDLL const char* mama_getVersion ( mamaBridge  bridgeImpl)

Return the version information for the library.

The version of the underlying transport follows in parens.

Parameters
bridgeImplThe bridge specific structure.
MAMAExpDLL mama_status mama_start ( mamaBridge  bridgeImpl)

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.

Parameters
bridgeImplThe bridge specific structure.
typedef void ( MAMACALLTYPE *  bridgeInfoCallback)

The callback invoked if an error occurs calling mama_startBackground() or when mama_startBackground() exits normally in which case status will be MAMA_STATUS_OK.

Callback passed to mama_setBridgeInfoCallback ().

Extended stop callback that improves on mamaStopCB by including a bridge impl pointer and closure in the signature.

Callback invoked when default thread for middleware has finished processing.

This will be invoked when info messages are logged at the bridge level. Currently only invoked for LBM log messages.

MAMAExpDLL mama_status mama_startBackground ( mamaBridge  bridgeImpl,
mamaStartCB  callback 
)

Start Mama in the background.

This method invokes mama_start() in a separate thread.

This API uses the deprecated mamaStartCB callback type. mama_startBackgroundEx uses the replacement type mamaStopCBEx. To retain backward compatability mama_startBackground casts callback to mamaStopCB for further processing.

Parameters
bridgeImplThe bridge specific structure.
callbackThe callback for asynchronous status.
Returns
MAMA_STATUS_OK if successful.
MAMAExpDLL mama_status mama_stop ( mamaBridge  bridgeImpl)

Stop dispatching on the default event queue for the specified bridge.

Parameters
bridgeImplThe bridge specific structure.
MAMAExpDLL mama_status mama_stopAll ( void  )

Stop dispatching on the default event queue for all bridges.

MAMAExpDLL mama_status mama_setApplicationName ( const char *  applicationName)

mama_setApplicationName - sets the mama application name This should be called before mama_open

Parameters
applicationName
MAMAExpDLL mama_status mama_setApplicationClassName ( const char *  className)

mama_setApplicationClass - sets the mama class name This should be called before mama_open

Parameters
className
MAMAExpDLL mama_status mama_getApplicationName ( const char **  applicationName)

mama_getApplicationName - gets the mama application name

Parameters
applicationNameaddress of where to put applicationName
MAMAExpDLL mama_status mama_getApplicationClassName ( const char **  className)

mama_getApplicationClass - sets the mama class name

Parameters
classNameaddress of where to put className
MAMAExpDLL mama_status mama_getUserName ( const char **  userName)

mama_getUserName - gets the user name

Parameters
userNameaddress of where to put user name
MAMAExpDLL mama_status mama_getHostName ( const char **  hostName)

mama_getHostName - gets the host name

Parameters
hostNameaddress of where to put host name
MAMAExpDLL mama_status mama_getIpAddress ( const char **  ipAddress)

mama_getIpAddressName - gets the IP Address

Parameters
ipAddressaddress of where to put IP address
MAMAExpDLL mama_status mama_getDefaultEventQueue ( mamaBridge  bridgeImpl,
mamaQueue defaultQueue 
)

Get a reference to the internal default event queue in use for the specified middleware.

Parameters
bridgeImplThe middleware for which the default event queue is being obtained.
defaultQueueAddress to which the defaultQueue is to be written.
Returns
MAMA_STATUS_OK if the function returns successfully.
MAMAExpDLL void mama_setLastError ( mamaError  error)

Set the last error to occur in Mama.

Each thread will have its own last error.

This function is for internal usage only.

Parameters
errorThe code of the last error to have occured in this thread.
MAMAExpDLL mamaError mama_getLastErrorCode ( void  )

Get the code of the last error to have occurred in Mama.

Each thread will have its own last error.

Parameters
errorThe code of the last error to have occured in this thread.
MAMAExpDLL const char* mama_getLastErrorText ( void  )

Get the text of the last error to have occurred in Mama.

Each thread will have its own last error.

Parameters
errorThe text of the last error to have occured in this thread.
MAMAExpDLL mama_status mama_setBridgeInfoCallback ( mamaBridge  bridgeImpl,
bridgeInfoCallback  callback 
)

Sets a callback to be invoked whenever an information message is logged at the bridge level.

Messages returned vary depending on the underlying middleware. Currently only implemented for LBM bridges.

MAMAExpDLL mama_status mama_addStatsCollector ( mamaStatsCollector  statsCollector)

Add a user stats collector.

MAMAExpDLL mama_status mama_removeStatsCollector ( mamaStatsCollector  statsCollector)

Remove a user stats collector.

Variable Documentation

typedef mamaBridge


© 2012 Linux Foundation