Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid binary character when transmitting ProtoBuf-net messages over AWS SQS

I'm using Protobuf-net (https://code.google.com/p/protobuf-net/) to serialize my class, and then trying to transmit this via amazon SQS.

When I do that I get this error:

Amazon.SQS.AmazonSQSException: Invalid binary character '#xC' was found in the message body, the set of allowed characters is #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF].

which is pretty self-explanatory.

Has anyone got a good solution on how to get this working?

like image 763
mcmillab Avatar asked May 02 '13 03:05

mcmillab


1 Answers

Only these characters are allowed in the message body: see the SendMessage API docs.

To send any binary content, you have to encode it, e.g. using Base64. The message is then larger, but contains only ASCII characters, which is even more strict than Amazon requires.

We are using this approach e.g. in the softwaremill-common library to send a serialized Java object.

like image 138
adamw Avatar answered Dec 01 '22 19:12

adamw