You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by artnaseef <ar...@artnaseef.com> on 2015/01/15 17:38:25 UTC

Re: How to send a struct via ActiveMQ CMS?

This is really a C/C++ question - how to serialize/de-serialize data.  There
is no simple answer.  Every time I've done any such thing in C/C++ (which
was my focus area for >15 years from College on), I wrote a custom
serializer/deserializer.

If you want something easier to code, and are not overly concerned with the
overhead, try looking for JSON libraries to make the task simpler and use
JSON on the wire.  Another nice thing about doing so is that JSON can be
processed easily with any language you might use.

Keep in mind that structures in C or C++ can be different after compilation
on different platforms due to padding and alignment constraints, and that
byte-ordering of the platform also leads to potential problems.



--
View this message in context: http://activemq.2283324.n4.nabble.com/How-to-send-a-struct-via-ActiveMQ-CMS-tp4689843p4689954.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: How to send a struct via ActiveMQ CMS?

Posted by Tim Bain <tb...@alumni.duke.edu>.
It's also possible to serialize to XML via libraries such as LMX (
http://www.codalogic.com/lmx/lmx-c++-xml-data-binding-features.php), so
JSON isn't the only option for serialization libraries you can reuse rather
than write.  And those libraries should have already handled byte ordering
and other platform-dependent things for you, so that's another advantage
for using one.

On Thu, Jan 15, 2015 at 9:38 AM, artnaseef <ar...@artnaseef.com> wrote:

> This is really a C/C++ question - how to serialize/de-serialize data.
> There
> is no simple answer.  Every time I've done any such thing in C/C++ (which
> was my focus area for >15 years from College on), I wrote a custom
> serializer/deserializer.
>
> If you want something easier to code, and are not overly concerned with the
> overhead, try looking for JSON libraries to make the task simpler and use
> JSON on the wire.  Another nice thing about doing so is that JSON can be
> processed easily with any language you might use.
>
> Keep in mind that structures in C or C++ can be different after compilation
> on different platforms due to padding and alignment constraints, and that
> byte-ordering of the platform also leads to potential problems.
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/How-to-send-a-struct-via-ActiveMQ-CMS-tp4689843p4689954.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>