Re: problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded

Tom Doust



Attached is a patch for OpenMAMA that provides an alternative function to populate a mamaMsg with the dictionary. This differs from the existining function by allowing the caller to pass a mamaMsg that has been pre-created on whatever payload is desired.


We are currently building and running the Tick42 RMDS bridge against OpenMAMA libraries with the patch applied. The new function is used something like this (with conditional compilation to show the ‘old’ version)


              // Prepare the OpenMAMA dictionary part of the message


              // provided mama has been patched for the new dictionary function we can create our own message on our own payload

              mamaMsg dictMsg=NULL;

              mamaMsg_createForPayload(&dictMsg, 'P');

              mama_status res = mamaDictionary_fillDictionaryMessage(dictionary, &dictMsg);


              mamaMsg dictMsg=NULL;

              mama_status res = mamaDictionary_getDictionaryMessage (dictionary, &dictMsg);




As I said before, in theory, it shouldn’t matter which payload a dictionary message uses, but in a context when multiple bridges are loaded it’s desirable to know which code is being executed.


I’m interested to hear from other bridge developers any thoughts, opiniions or questions on this subject


Best regards




The patch is also shown below




diff --git a/README b/README

index be1ad38..f278d0d 100644

--- a/README

+++ b/README

@@ -2,7 +2,7 @@ OpenMAMA Client Library


 Release: 2.3.1

-Change Log:;a=shortlog;h=refs/heads/OpenMAMA-2.3.1

+Change Log:;a=shortlog;h=refs/tags/OpenMAMA-2.3.1-release

 Project Page


diff --git a/mama/c_cpp/src/c/dictionary.c b/mama/c_cpp/src/c/dictionary.c

index 7f7d605..8a6d275 100644

--- a/mama/c_cpp/src/c/dictionary.c

+++ b/mama/c_cpp/src/c/dictionary.c

@@ -496,6 +496,21 @@ mamaDictionary_getDictionaryMessage (



+             mamaDictionary_fillDictionaryMessage (

+             mamaDictionary dictionary,

+             mamaMsg* msg)


+             mamaDictionaryImpl* impl = (mamaDictionaryImpl*)dictionary;


+             if (!impl) return MAMA_STATUS_NULL_ARG;

+             if (!msg) return MAMA_STATUS_INVALID_ARG;


+             populateMessageFromDictionary (impl, *msg);


+             return MAMA_STATUS_OK;




mamaDictionary_createFieldDescriptor (

                 mamaDictionary       dictionary,

                 mama_fid_t           fid,

diff --git a/mama/c_cpp/src/c/mama/dictionary.h b/mama/c_cpp/src/c/mama/dictionary.h

index 0eda958..40f7885 100644

--- a/mama/c_cpp/src/c/mama/dictionary.h

+++ b/mama/c_cpp/src/c/mama/dictionary.h

@@ -268,6 +268,22 @@ mamaDictionary_getDictionaryMessage (

     mamaMsg* msg);


+ * Fill a message with the data dictionary.

+ *

+ * An existing mama message is populated fromt he data dictionary

+ * This allows the caller to create the message on a specifc payload

+ *

+ * @param dictionary The Dictionary

+ * @param msg The address of the mamaMsg where the result is to be written

+ */


+extern mama_status

+mamaDictionary_fillDictionaryMessage (

+    mamaDictionary dictionary,

+    mamaMsg* msg);




  * Create a new field descriptor and add it to the dictionary.

  * New fields can be added to an existing dictionary obtained

  * from the MAMA infrastructure. This function can also be used







From: Tom Doust
Sent: 29 August 2014 10:12 AM
To: Openmama-dev@...
Subject: problem with mamaDictionary_getDictionaryMessage when multiple bridges are loaded




mama_status mamaDictionary_getDictionaryMessage (mamaDictionary dictionary,mamaMsg* msg)



creates the message it returns using mamaMsg_create (&tempMsg); this creates the message using the default payload which may not be the payload type for the bridge that is trying to populate a message with its dictionary.


Now, while in theory it shouldn’t really matter, in the real world it does, for a variety of reasons.


I can see 2 possible solutions, one is to extend the existing function signature to carry a payload id (or a bridge) so that a payload specific mamaMsg can be created, or better, implement a second function that allows the caller to pre-create the message that is passed in. This second solution would not affect any existing code.


I’ll create and submit a patch, but before I do I’m soliciting comments and proposals for better solutions.





TOM DOUST | Head of Consultancy                                                                                                         


P: +44 (0) 1628 477444 | M: +44 (0) 7710 479924 | E: tom.doust@... | skype:  tom.doust |  



Join to automatically receive all group messages.