Closed MangoCats closed 8 years ago
@MangoCats I wouldn't doubt that we have issues with binary data, having taken a look at the code (caveat: I wrote this fork a few years back when I was actively using amqp 0-9-1, however am no longer using this code, just maintaining it). The relevant bits are here:
Specifically, you can see that if you are passing in a QByteArray (your raw data, not a QString), then you are required to specify a mime type (per QAMQP's api, I'm not sure what the spec says here). Did you try that out? Beyond that, I'd have to refer back to the spec (which is sort of woefully incomplete), but you might have to encode your binary data (say as base64) before transferring it.
Thanks for this, I hadn't been specifying a MIME type before, just going with default like the tutorial code. I just tried "application/octet-stream" and that seems to be working perfectly. Most excellent!
@MangoCats cool, glad that worked for you. Were you passing in a QByteArray by any chance? It would be nice to catch that path and stop the implicit conversion to QString (which is what I assume was happening).
Yes, I just constructed a QByteArray like this to pass in for testing:
QByteArray message; for( int i = 0; i < 256; i++ ) message[i] = i;
Initially, nothing came through - masking off the NULL at the front helped, but still was translating the values >127 until I specified the MIME type. With the MIME type, all 256 codes appear to be passed intact.
I see what you mean in:
it was probably doing the implicit conversion since I didn't specify a MIME type. Maybe specifying a default MIME type could help this case? I'm going to be doing some performance testing of this in the near future (for example: sending ~1K binary payloads ~500 times a second), if I see any significant impact of specifying the MIME type vs leaving it empty, I'll try to remember to bring those results back here.
I'm considering using qamqp to deliver binary messages via a RabbitMQ server, but I am having difficulty with the null character, as well as any character > 0x7f.
I took one of the tutorials and replaced the message with a QByteArray filled with byte values 0-255 for testing... as long as the values range 1-127, it works as expected.
As I understand the AMQP protocol, any binary message should be valid, but I do notice many client implementations (Java, PHP, etc.) with trouble tickets concerning binary messages, especially NULL values causing trouble.
Is this a known problem in qamqp?