azure-sdk-for-python: [ServiceBus] message.dead_letter doesn't set any properties of message which is consistent with the .NET Sdk

Customer report:

When you are receiving a message and explicitly try to deadletter it (message.dead_letter(description)), the description (string) doesn’t show up in the properties of the message even when it is specified. I tried it with the regular dead_letter and also async dead_letter in Python, both returned these properties of the message: “properties”: {}, When I run the same test using the .NET SDK for Service Bus, it works as expected. Here are the message properties from .NET “properties”: { “DeadLetterReason”: “bad” }


Repro:

    queue_client = client.get_queue(standard_queue)
    with queue_client.get_receiver(idle_timeout=5, mode=ReceiveSettleMode.PeekLock, prefetch=10) as receiver:

        with queue_client.get_sender() as sender:
            for i in range(10):
                message = Message("Dead lettered message no. {}".format(i))
                sender.send(message)

        count = 0
        messages = receiver.fetch_next()
        while messages:
            for message in messages:
                print_message(message)
                message.dead_letter(description="Testing queue deadletter")
                count += 1
            messages = receiver.fetch_next()

    assert count == 10

    with queue_client.get_deadletter_receiver(idle_timeout=5, mode=ReceiveSettleMode.PeekLock) as receiver:
        count = 0
        for message in receiver:
            print_message(message)
            assert message.user_properties
            assert message.user_properties[b"DeadLetterReason"]
            message.complete()
            count += 1
    assert count == 10

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 18 (10 by maintainers)

Most upvoted comments

My apologies for the previous response (deleted). This is working correctly in 0.50.3 - Thanks!