Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not send message to dead letter queue from new receiver #35304

Closed
ColinBe95 opened this issue Apr 22, 2024 · 9 comments · Fixed by #36080
Closed

Can not send message to dead letter queue from new receiver #35304

ColinBe95 opened this issue Apr 22, 2024 · 9 comments · Fixed by #36080
Assignees
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Messaging Messaging crew question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus

Comments

@ColinBe95
Copy link

  • Package Name:
    azure-servicebus 7.12.1
    azure-core 1.30.1
    aiohttp 3.9.3
  • Package Version:
    7.12.1
  • Operating System:
    Windows 10
  • Python Version:
    3.9.0
    Describe the bug
    Not sure if this is a bug or desired behavior, but I was very confused by the following:
    When writing a message to the dead letter queue like
from azure.servicebus.aio import ServiceBusReceiver, ServiceBusClient
import os 

connection_string = os.environ["ASB_NAMESPACE_CONNECTION_STRING"]
queue_name = "test-queue"

async with ServiceBusClient.from_connection_string(connection_string) as client:
    async with client.get_queue_receiver(queue_name) as receiver:
        messages = await receiver.receive_messages(max_message_count=1)
        await receiver.dead_letter_message(messages[0])

the message ends up in the DLQ as expected. But when running:

async with ServiceBusClient.from_connection_string(connection_string) as client:
    async with client.get_queue_receiver(queue_name) as receiver:
        messages = await receiver.receive_messages(max_message_count=1)

    async with client.get_queue_receiver(queue_name) as receiver:
        await receiver.dead_letter_message(messages[0])

nothing happens. No error message, nothing. The message does not end up in the DLQ. So basically it seems impossible to add messages to the DLQ once the receiver was closed. Am I missing something?

For my current implementation it would be great if it was possible to send a message to the DLQ even after the receiver was closed.
To Reproduce
Steps to reproduce the behavior:

  1. Code examples above are valid and should work

Expected behavior
Sending messages to DLQ after closing the receiver should be possible. Otherwise there should be an exception raised or some information added in the docs.

Screenshots

Additional context

@github-actions github-actions bot added Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Attention Workflow: This issue is responsible by Azure service team. Service Bus labels Apr 22, 2024
Copy link

Thanks for the feedback! We are routing this to the appropriate team for follow-up. cc @EldertGrootenboer.

@kashifkhan
Copy link
Member

Thank you for the feedback @ColinBe95. We will investigate and get back to you asap.

@kashifkhan kashifkhan added Messaging Messaging crew and removed Service Attention Workflow: This issue is responsible by Azure service team. needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Apr 22, 2024
@kashifkhan kashifkhan self-assigned this Apr 22, 2024
@github-actions github-actions bot added needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team needs-team-triage Workflow: This issue needs the team to triage. labels Apr 22, 2024
@ColinBe95
Copy link
Author

btw this behavior is not limited to async, i.e. it is reproducible with the synchronous client. This code snippet works:

from azure.servicebus import ServiceBusClient

connection_string = os.environ["ASB_NAMESPACE_CONNECTION_STRING"]
queue_name = "test-queue"
with ServiceBusClient.from_connection_string(connection_string) as client:
    with client.get_queue_receiver(queue_name) as receiver:
        messages = receiver.receive_messages(max_message_count=1)
        receiver.dead_letter_message(messages[0])

While the following does not:

with ServiceBusClient.from_connection_string(connection_string) as client:
    with client.get_queue_receiver(queue_name) as receiver:
        messages = receiver.receive_messages(max_message_count=1)

    with client.get_queue_receiver(queue_name) as receiver:
        receiver.dead_letter_message(messages[0])

@xiangyan99 xiangyan99 removed the needs-team-triage Workflow: This issue needs the team to triage. label Apr 23, 2024
@ColinBe95
Copy link
Author

I think I have found the solution to my initial question myself in this discussion Azure/azure-service-bus#455 . However, I still believe raising an exception here would have been a better experience for the developer?

@kashifkhan
Copy link
Member

@ColinBe95 yes this is a bug on our end, there should be at the minimum an exception raised or alternate means of sending the message over the dead letter queue. Ill update this thread once we have a PR ready to go

@ColinBe95
Copy link
Author

@kashifkhan cool, thank you!

@kashifkhan
Copy link
Member

@ColinBe95 I have included a link to the PR that addresses this issue. Ill be marking this issue as addressed but will update here when we push this out to pypi

@kashifkhan kashifkhan added the issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. label Jun 19, 2024
Copy link

Hi @ColinBe95. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text "/unresolve" to remove the "issue-addressed" label and continue the conversation.

@github-actions github-actions bot removed the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Jun 19, 2024
Copy link

Hi @ColinBe95, since you haven’t asked that we /unresolve the issue, we’ll close this out. If you believe further discussion is needed, please add a comment /unresolve to reopen the issue.

@github-actions github-actions bot locked and limited conversation to collaborators Sep 24, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. customer-reported Issues that are reported by GitHub users external to the Azure organization. issue-addressed Workflow: The Azure SDK team believes it to be addressed and ready to close. Messaging Messaging crew question The issue doesn't require a change to the product in order to be resolved. Most issues start as that Service Bus
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants