API Guide

For the latest documentation, including developing guides and other detailed information, check out the OpenMAMA wiki site, over at http://wiki.openmama.org/ 

However, in order to get started, the OpenMAMA and OpenMAMDA developers guides are available directly from the links below. 

More complete documentation is available on the documentation page.

API Code Samples:

When writing a pub/sub application using the OpenMAMA API,  certain initialization must occur before creating publisher and subscriber objects. After initializing the API, you need to create a publisher object to publish custom messages and a basic subscription object to consume those published messages.

Initialisation

Both the publisher and subscriber application need to load in the bridge object that determines the underlying middleware your application will use to publish and subscribe to market or custom messages. After loading the bridge object, you need to initialize the API using the mama_open method, this initialization method loads the mama.properties file, located in $WOMBAT_PATH,  and sets up the environment. After initializing the API you would need to establish the connection between the publisher and subscriber by creating transport using the mamaTransport object.

Below is the code sample that is used to initialize the API.

Publisher

After initialization, the application creates the publisher object using the mamaPublisher_create method. Using the publisher and the transport object, the application can now publish custom or market data messages on a particular topic:  the same topic, which would be used by the subscriber application to consume the published messages. To publish any custom message, a mamaMsg object needs to be created and populated using the mamaMsg_addXXX methods.

Below is the code sample that is used to publish message

Subscriber

After initialization, the subscribing application creates a subscription object using the mamaSubscription_createBasic method. Using the subscription object, the application, which is subscribed to the specified topic, receives a message published on that topic: the messages are delivered via callbacks to the application.

Below is the code sample that is used to subscribe to a topic