Copy fields from a message of another payload type


Yury Batrakov
 

Classification: Public

Hi everyone,

I'm migrating my middleware and payload bridges to OpenMAMA 2.4.1. What I found is that the number of functions were deprecated in new release, for example mamaMsg_getPayloadType. In my bridge I support sending data of other payload types and this deprecation breaks my code. Could you advise how to port the following pseudo code to 2.4.1?

send_message(msg) {
if(mamaMsg_getPayloadType(msg) == MY_TYPE) {
bytes = serialize_fast(msg);
send(bytes);
} else {
// Create a new message of my type and copy all fields from original message to it
copy = mamaMsg_create();
mamaMsg_iterateFields(msg, copy_each_field, copy);
send_message(copy);
}
}



---
This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error) please notify the sender immediately and delete this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.

Please refer to https://www.db.com/disclosures for additional EU corporate and regulatory disclosures and to http://www.db.com/unitedkingdom/content/privacy.htm for information about privacy.

Join Openmama-dev@lists.openmama.org to automatically receive all group messages.