Peeking ServiceBus messages does not contain any information about if it's deferred or not
See original GitHub issue- Package Name:
azure-servicebus - Package Version:
7.0.1 - Operating System: Linux RHEL 8
- Python Version: 3.9
Describe the bug Peeking messages does not contain information whether it’s deferred or not.
To Reproduce Steps to reproduce the behavior:
- Defer a message
- Peek messages:
>>> metro_client = ServiceBusClient.from_connection_string(conn_str="my_conn_str'', transport_type=TransportType.AmqpOverWebsocket)
>>> receiver = metro_client.get_subscription_receiver(topic_name='my-sub', subscription_name='sub-my-sub-example')
>>> messages = asyncio.run(receiver.peek_messages(5, sequence_number=5)) # Get the message you want
>>> message = message[0]
>>> message._is_deferred_message
False
Expected behavior I expect the message to be marked as a deferred message, or have any indication that it is such.
What I want to achieve There might be a better way of doing this (e.g. with dead letters?), so I’ll explain the use case, in case there’s a better solution:
- Have a container receive messages
- Mark the message as something, so that I can pick it up later
- Start a background task (through Celery) based on the subject of the message
- The background task will then fetch the message and mark it as completed when the task is completed
Now, if the background task for some reason would fail, I need to be able to fetch all the messages that never was completed (in my current case deferred), I can decide how to act on them. I wanted to do this:
- Fetch all deferred messages and show them to the user (GET API using peek)
- A user can select messages and retry them through sending a POST request to our API with the sequence number of that task. Our backend would then fetch that message and execute the task. When the task is completed, the message would be marked as such.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Peeking Azure ServiceBus messages does not return ...
Using regular queues, Peek works as expected and returns both Active, Deferred and Scheduled messages, as one would expect :-)
Read more >message browsing - Azure Service Bus | Microsoft Learn
Browse and peek Service Bus messages enables an Azure Service Bus client to enumerate all messages in a queue or subscription.
Read more >Azure Service Bus Essentials — Message Settlement with ...
How does a Service Bus consumer use the SDK client to complete, abandon, defer, or dead-letter a received message under peek-lock mode?
Read more >Azure Service Bus and its Complete Overview | Serverless360
It is also required to have instantaneous consistency, temporal control like if this is not processed in x amount of minutes then the...
Read more >ColdFusion and Azure Service Bus - Adobe Support
Defer message. When a queue or subscription client receives a message that it is willing to process, but for which processing is not...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The GitHub repo for feature requests for the service is https://github.com/Azure/azure-service-bus
Related issues to the one being discussed are https://github.com/Azure/azure-service-bus/issues/442 and https://github.com/Azure/azure-service-bus/issues/95. Please participate in these issues to get input from the service team.
Closing this issue as there are no planned next steps from the SDK perspective.
As and when the service implements this feature, we will incorporate it in the SDK
Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @jfggdl, @axisc.
Issue Details
azure-servicebus7.0.1Describe the bug Peeking messages does not contain information whether it’s deferred or not.
To Reproduce Steps to reproduce the behavior:
Expected behavior I expect the message to be marked as a deferred message, or have any indication that it is such.
What I want to achieve There might be a better way of doing this (e.g. with dead letters?), so I’ll explain the use case, in case there’s a better solution:
Now, if the background task for some reason would fail, I need to be able to fetch all the messages that never was completed (in my current case deferred), I can decide how to act on them. I wanted to do this:
Client,Service Attention,Service Bus,customer-reported,feature-request