On Tue, Nov 16, 2021 at 12:17 PM Kai <sophokles...@gmail.com> wrote:
> I am trying to set some application properties on a message to be sent
> using Qpid Python 0.36 using the following code:
> msg = Message(
>                 body="the body",
>                 properties={
>                     "status": 200
>                 },
>                 address="reply-to-address",
>                 correlation_id="correlationId",
>                 content_type="text/plain"
>             )
>
> when I send this message then at the consumer side I am not able to
> retrieve the "status" from the message's application properties.

It works for me (sending message above, I can print out the properties
in a receiver and see the status set as expected). If you run the
python program with PN_TRACE_FRM=1, what do you see for the transfer
content?


(I see 
"\x00SpE\x00Ss\xd0\x00\x00\x005\x00\x00\x00\x07@@\xa1\x10reply-to-address@@\xa1\x0dcorrelationId\xa3\x0atext/plain\x00St\xd1\x00\x00\x00\x15\x00\x00\x00\x02\xa1\x06status\x81\x00\x00\x00\x00\x00\x00\x00\xc8\x00Sw\xa1\x08the
body" using

#!/usr/bin/env python

from proton import Message
from proton.handlers import MessagingHandler
from proton.reactor import Container

class Test(MessagingHandler):
    def __init__(self, url):
        super(Test, self).__init__()
        self.url = url
        self.sent = False

    def on_start(self, event):
        event.container.create_sender(self.url)
        event.container.create_receiver(self.url)

    def on_sendable(self, event):
        if not self.sent:
            msg = Message(
                body="the body",
                properties={
                    "status": 200
                },
                address="reply-to-address",
                correlation_id="correlationId",
                content_type="text/plain"
            )
            event.sender.send(msg)
            self.sent = True

    def on_message(self, event):
        print("properties:", event.message.properties)
        print("body:", event.message.body)
        event.receiver.close()
        event.connection.close()

    def on_accepted(self, event):
        event.connection.close()

try:
    Container(Test("localhost/examples")).run()
except KeyboardInterrupt:
    pass


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@qpid.apache.org
For additional commands, e-mail: users-h...@qpid.apache.org

Reply via email to