Topics

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.


Frank Quinn <fquinn.ni@...>
 

Hi Yury,

You can still do something similar - it's the enum that is deprecated - payloads are still expected to have their own identifier, you just access it with a private method now, namely  mamaMsgImpl_getPayloadId.

Qpid proton actually has something similar which should provide a working reference for this approach:

https://github.com/OpenMAMA/OpenMAMA/blob/next/mama/c_cpp/src/c/bridge/qpid/codec.c

Cheers,
Frank


On Wed, 24 Aug 2016, 16:53 Yury Batrakov, <yury.batrakov@...> wrote:
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.
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev


Yury Batrakov
 

Classification: Public

Hi Frank,

 

Thank you, this is exactly what I searched for.

 

From: Frank Quinn [mailto:fquinn.ni@...]
Sent: Wednesday, August 24, 2016 11:19 PM
To: Yury Batrakov; openmama-dev@...
Subject: Re: [Openmama-dev] Copy fields from a message of another payload type

 

Hi Yury,

You can still do something similar - it's the enum that is deprecated - payloads are still expected to have their own identifier, you just access it with a private method now, namely  mamaMsgImpl_getPayloadId.

Qpid proton actually has something similar which should provide a working reference for this approach:

https://github.com/OpenMAMA/OpenMAMA/blob/next/mama/c_cpp/src/c/bridge/qpid/codec.c

Cheers,
Frank

 

On Wed, 24 Aug 2016, 16:53 Yury Batrakov, <yury.batrakov@...> wrote:

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.
_______________________________________________
Openmama-dev mailing list
Openmama-dev@...
https://lists.openmama.org/mailman/listinfo/openmama-dev



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