Writing protocol buffer data in C++ and reading in Java over AMQP/JMS -


so i'm bit stumped on this. i've got amqp class implementation on c++ side serializes porotocol buffer object string:

qpid::messaging::message qmesg; std::string msgstr; protomessage.serializetostring(&msgstr); qmesg.setcontent(msgstr);  //proceed send message 

the message body set this, , content type binary.

on java side, we're reading bytes in jmsbytesmessage object, trying parse data protocol buffer object:

jmsbytesmessage msg; //assume in proper context protomessage.parsefrom(msg.getdata().array()); 

i've tried:

byte[] bytearr = new byte[] msg.readbytes(bytearr); 

which gives same.

when log byte data, see byte values (using array.tostring(byte[]), code above on java side throws invalidprotocolbufferexception:

com.google.protobuf.invalidprotocolbufferexception: protocol message contained     invalid tag (zero). 

i'd assume since it's byte data, it's anonymous character encoding. missing obvious? also, please refrain alternative implementation suggestions regardless of how awkward looks, assume 1 must used. guidance appreciated.

protocol buffer byte array values (maybe unnecessary? why not) edit: diffed byte results, interesting.

edit: top decoded in java, bottom encoded in c++:

10 0 18 0 34 0 42 0 50 0 58 0 82 0 90 0 98 0 106 0 114 0 122 0 -126 1 6 97 99 99 101 112

10 0 18 0 34 0 42 0 50 0 58 0 82 0 90 0 98 0 106 0 114 0 122 0 130 1 6 97 99 99 101 112

these first few, pattern continues. of data same, bytes changed signed unsigned. don't work in java much, what's going on here?

this total guess, perhaps part of byte array real message, , perhaps 0 end of it. initial allocation bigger actual message , need track number of bytes written, , read many on other side.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -