C# Class Wombat.Mama

MAMA - Middleware Agnostic Messaging API
MAMA provides an abstraction layer over various messaging middleware platforms. In particular, MAMA adds market data semantics to messaging platforms that would otherwise be too limited for use as a market data distribution middleware. Features that MAMA adds to any messaging middleware are: Subscription management (initial values, throttling). Entitlements/permissioning. Data quality. MAMA currently supports the following middleware platforms: Wombat TCP Middleware 29West Latency Busters Messaging (see http://29west.com) Tibco TIB/RV versions 6 and 7 (see http://tibco.com)

Future supported platforms may include: Tibco SmartSockets (see http://tibco.com) Reuters SSL, SFC, TibMsg, etc.

A higher level market data API is also available: the Middleware Agnostic Market Data API (MAMDA). While MAMA provides a field-based abstraction to market data, MAMDA provides smart, specialized data types to deal with specific market data events, such as trades, quotes, order books, etc. MAMDA is particularly suitable for applications such as program trading and tick capture systems, where context is important. MAMA is more suited to applications that don't care about the meaning of fields, such as a simple, field-based market data display application.

Afficher le fichier Open project: OpenMAMA/OpenMAMA Class Usage Examples

Méthodes publiques

Méthode Description
close ( ) : void

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.

defaultLogFunction ( MamaLogLevel level, string text ) : void

This function will invoke the default log function.

disableLogging ( ) : void

Disable logging.

enableLogging ( MamaLogLevel level ) : void

Enable logging.

getDefaultEventQueue ( Wombat.MamaBridge bridgeImpl ) : Wombat.MamaQueue

getLogLevel ( ) : MamaLogLevel

Get the log level.

getProperty ( string name ) : string

Retrieve a specific property from the API. If the property has not been set, a null value will be returned.

getVersion ( Wombat.MamaBridge bridgeImpl ) : string

Return the version information for the library The version of Mama follows in parenthesis

loadBridge ( string middleware ) : Wombat.MamaBridge

Load the bridge specified by middleware string. If the bridge has already been loaded then the existing bridge instance will be returned.

loadBridge ( string middleware, string path ) : Wombat.MamaBridge

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

loadPayloadBridge ( string payload ) : Wombat.MamaPayloadBridge

Load the payload brige specified by the payload string.

log ( MamaLogLevel level, string text ) : void

Add string to mama log at specified mama level.

logToFile ( string fileName, MamaLogLevel level ) : void

Enable logging, accepts a string representing the file location.

loggingToFile ( ) : bool

Get logging to file status

onNativeLogCallback ( int level, string message ) : void

This handler is called by the C layer whenever a log comes in, it will invoke the managed object.

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

openWithProperties ( string path, string filename ) : void

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

setAppendToLogFile ( bool append ) : void

Set append to prevent overwriting existing logfiles.

setDefaultQueueHighWatermark ( int highWatermark ) : void

Set the high watermark for the internal default MAMA queue. See mamaQueue_setHighWatermark() for details. Although the monitoring callbacks on the default queue cannot be specified for RV, setting of the high water mark is still supported.

setDefaultQueueLowWatermark ( int lowWatermark ) : void

Set the low watermark for the internal default MAMA queue. See mamaQueue_setLowWatermark() for details. Currently supported only on Wombat TCP middleware.

setLogCallback ( MamaLogFileCallback2 callback ) : void

Sets the log callback, this will be invoked every time a log is written in MAMA.

setLogFilePolicy ( MamaLogFilePolicy policy ) : void

Set logging policy.

setLogLevel ( MamaLogLevel level ) : void

Set the log level.

setLogSize ( ulong size ) : void

Set the log file max size.

setLogSizeCb ( MamaLogFileCallback callback ) : void

Set callback for log max size exceeded. Applies only to USER policy.

setNumLogFiles ( int numFiles ) : void

Set the max number of log files.

setProperty ( string name, string value ) : void

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.

start ( Wombat.MamaBridge bridgeImpl ) : void

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.

startBackground ( Wombat.MamaBridge bridgeImpl, MamaStartBackgroundCallback callback ) : void

Start Mama in the background. This method invokes Mama.start() in a separate thread.

stop ( Wombat.MamaBridge bridgeImpl ) : void

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.

Private Methods

Méthode Description
getVersion ( IntPtr bridgeImpl ) : string

Return the version information for the library The version of Mama follows in parenthesis

initGetVersionWrapper ( ) : void
onNativeLogSizeExceeded ( ) : void

This event handler is called whenever the log size is exceeded.

Method Details

close() public static méthode

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.
public static close ( ) : void
Résultat void

defaultLogFunction() public static méthode

This function will invoke the default log function.
/// The logging text has not been supplied. /// /// The logging level is invalid. ///
public static defaultLogFunction ( MamaLogLevel level, string text ) : void
level MamaLogLevel /// The level to log at. ///
text string /// The log message. ///
Résultat void

disableLogging() public static méthode

Disable logging.
public static disableLogging ( ) : void
Résultat void

enableLogging() public static méthode

Enable logging.
/// The file name contains invalid characters. ///
public static enableLogging ( MamaLogLevel level ) : void
level MamaLogLevel /// The logging level allowed. ///
Résultat void

getDefaultEventQueue() public static méthode

public static getDefaultEventQueue ( Wombat.MamaBridge bridgeImpl ) : Wombat.MamaQueue
bridgeImpl Wombat.MamaBridge
Résultat Wombat.MamaQueue

getLogLevel() public static méthode

Get the log level.
public static getLogLevel ( ) : MamaLogLevel
Résultat MamaLogLevel

getProperty() public static méthode

Retrieve a specific property from the API. If the property has not been set, a null value will be returned.
public static getProperty ( string name ) : string
name string
Résultat string

getVersion() public static méthode

Return the version information for the library The version of Mama follows in parenthesis
public static getVersion ( Wombat.MamaBridge bridgeImpl ) : string
bridgeImpl Wombat.MamaBridge
Résultat string

loadBridge() public static méthode

Load the bridge specified by middleware string. If the bridge has already been loaded then the existing bridge instance will be returned.
public static loadBridge ( string middleware ) : Wombat.MamaBridge
middleware string
Résultat Wombat.MamaBridge

loadBridge() public static méthode

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
public static loadBridge ( string middleware, string path ) : Wombat.MamaBridge
middleware string
path string
Résultat Wombat.MamaBridge

loadPayloadBridge() public static méthode

Load the payload brige specified by the payload string.
public static loadPayloadBridge ( string payload ) : Wombat.MamaPayloadBridge
payload string
Résultat Wombat.MamaPayloadBridge

log() public static méthode

Add string to mama log at specified mama level.
/// The logging level is invalid. ///
public static log ( MamaLogLevel level, string text ) : void
level MamaLogLevel /// The level to log at. ///
text string /// The log message. ///
Résultat void

logToFile() public static méthode

Enable logging, accepts a string representing the file location.
/// The file name is null or blank. /// /// The file name contains invalid characters. ///
public static logToFile ( string fileName, MamaLogLevel level ) : void
fileName string /// The full path to the log file. ///
level MamaLogLevel /// The logging level allowed. ///
Résultat void

loggingToFile() public static méthode

Get logging to file status
public static loggingToFile ( ) : bool
Résultat bool

onNativeLogCallback() public static méthode

This handler is called by the C layer whenever a log comes in, it will invoke the managed object.
public static onNativeLogCallback ( int level, string message ) : void
level int /// The log level. ///
message string /// The log message. ///
Résultat void

open() public static méthode

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.
public static open ( ) : void
Résultat void

openWithProperties() public static méthode

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
public static openWithProperties ( string path, string filename ) : void
path string /// Fully qualified path to the directory containing the properties /// file ///
filename string /// The name of the file containing MAMA properties. ///
Résultat void

setAppendToLogFile() public static méthode

Set append to prevent overwriting existing logfiles.
public static setAppendToLogFile ( bool append ) : void
append bool
Résultat void

setDefaultQueueHighWatermark() public static méthode

Set the high watermark for the internal default MAMA queue. See mamaQueue_setHighWatermark() for details. Although the monitoring callbacks on the default queue cannot be specified for RV, setting of the high water mark is still supported.
public static setDefaultQueueHighWatermark ( int highWatermark ) : void
highWatermark int
Résultat void

setDefaultQueueLowWatermark() public static méthode

Set the low watermark for the internal default MAMA queue. See mamaQueue_setLowWatermark() for details. Currently supported only on Wombat TCP middleware.
public static setDefaultQueueLowWatermark ( int lowWatermark ) : void
lowWatermark int
Résultat void

setLogCallback() public static méthode

Sets the log callback, this will be invoked every time a log is written in MAMA.
public static setLogCallback ( MamaLogFileCallback2 callback ) : void
callback MamaLogFileCallback2 /// The callback to invoke. ///
Résultat void

setLogFilePolicy() public static méthode

Set logging policy.
public static setLogFilePolicy ( MamaLogFilePolicy policy ) : void
policy MamaLogFilePolicy
Résultat void

setLogLevel() public static méthode

Set the log level.
/// The file name contains invalid characters. ///
public static setLogLevel ( MamaLogLevel level ) : void
level MamaLogLevel /// The logging level allowed. ///
Résultat void

setLogSize() public static méthode

Set the log file max size.
/// Thrown if the size is 0. ///
public static setLogSize ( ulong size ) : void
size ulong
Résultat void

setLogSizeCb() public static méthode

Set callback for log max size exceeded. Applies only to USER policy.
public static setLogSizeCb ( MamaLogFileCallback callback ) : void
callback MamaLogFileCallback /// The callback object to invoke whenever the log size is exceeded. ///
Résultat void

setNumLogFiles() public static méthode

Set the max number of log files.
/// Thrown if the number of files is 0 or less. ///
public static setNumLogFiles ( int numFiles ) : void
numFiles int
Résultat void

setProperty() public static méthode

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.
public static setProperty ( string name, string value ) : void
name string
value string
Résultat void

start() public static méthode

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.

public static start ( Wombat.MamaBridge bridgeImpl ) : void
bridgeImpl Wombat.MamaBridge /// The bridge specific structure. ///
Résultat void

startBackground() public static méthode

Start Mama in the background. This method invokes Mama.start() in a separate thread.
public static startBackground ( Wombat.MamaBridge bridgeImpl, MamaStartBackgroundCallback callback ) : void
bridgeImpl Wombat.MamaBridge /// The bridge specific structure. ///
callback MamaStartBackgroundCallback /// The callback for asynchronous status. ///
Résultat void

stop() public static méthode

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.
public static stop ( Wombat.MamaBridge bridgeImpl ) : void
bridgeImpl Wombat.MamaBridge /// The bridge specific structure. ///
Résultat void