[ 
https://issues.apache.org/jira/browse/PROTON-1924?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Robbie Gemmell closed PROTON-1924.
----------------------------------
    Resolution: Invalid

This should probably have been raised on the discussion lists first: 
http://qpid.apache.org/discussion.html

The specific 'unexpected extra bytes' issue isn't a bug in proton. It may not 
be a bug in anything (well, perhaps your receiving application, depending on 
expected IoT Hub behaviour) and could just be an implementation choice of IoT 
Hub when consuming a message over MQTT that were originally sent over AMQP. 
You'll have to ask Microsoft about such details of their products, or maybe 
they have documented it.

"\xa1\x0bHello World" is the AMQP encoded representation of the string "Hello 
World", which will be getting sent within an amqp-value body section by proton, 
and so those bytes would be precisely what it should send such that a receiver 
(IoT Hub) knows that it has been sent a string of that length with that 
content. It seems possible that Microsoft are just dumping the undecoded bytes 
within the amqp-value section directly into the MQTT message, in which case you 
might get what you see here. I'd guess thats what they do since if they were to 
decode it first, although its easy enough to see something to do with an ascii 
string in this case, it isn't for many other possible values and so they may 
just require recipients to decode the raw content themselves.

They may do something different if sent an amqp-value containing a Binary value 
rather than a string value, but they very likely might not. Add a 'b' prefix to 
your body to result in sending a Binary value instead of a String value. 
Alternatively still, you could try sending bytes in a 'data' body section 
instead of 'amqp-value' section, in which case they might just give the raw 
bytes, but again might not. Also set msg.inferred = True on the message before 
sending to do that.

On the uamqp comment, without some/any detail its not possible to say anything 
there. If youve got more details, feel free to raise it on the mailing lists 
for discussion, or open a JIRA if theres a verifiable bug in proton.

> Extra symbols in body while sending to Azure IoT Hub
> ----------------------------------------------------
>
>                 Key: PROTON-1924
>                 URL: https://issues.apache.org/jira/browse/PROTON-1924
>             Project: Qpid Proton
>          Issue Type: Bug
>          Components: python-binding
>    Affects Versions: proton-c-0.22.0, proton-c-0.24.0
>            Reporter: Richard
>            Priority: Major
>
> When sending AMQP message to Azure Iot Hub 
> (amqps://example.azure-devices.net/messages/devicebound), proton is putting 
> some extra, unwanted symbols before my actual body content.
> {code}
> IOT_HUB_LISTENER = "/messages/devicebound"
> user = f"{IOT_HUB_SHARED_ACCESS_KEY_NAME}@sas.root.{HOST}"
> password = SAS_TOKEN
> # connect
> blocking_connection = BlockingConnection(f"amqps://{IOT_HUB_HOSTNAME}", 
> allowed_mechs="PLAIN", user=user, password=password)
> sender = blocking_connection.create_sender(IOT_HUB_LISTENER)
> sender.send(Message(address=f"/devices/{device_id}/messages/devicebound", 
> body="Hello World"))
> {code}
> The message is sent to Azure IoT Hub as I mentioned, but while reading the 
> message from IoT Hub over MQTT, in the payload I receive every time something 
> like this:
> {code}
> payload = b'*\xa1\x0b*Hello World'
> {code}
> I know that proton is encoding the message body according to its data type 
> before the actual send to AMQP Broker (Azure IoT Hub) happens. Maybe comes 
> this error from there? Is there a possibility to disable putting those 
> symbols before actual body?
>  
> BTW: If you try to receive "proton" amqp message with uamqp from Microsoft, 
> you'll get amqp incompatibly error. Reversed it works. Is proton doing 
> something different?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to