Azure / azure-functions-python-worker

Python worker for Azure Functions.
http://aka.ms/azurefunctions
MIT License
333 stars 103 forks source link

How to defer messages within a Service Bus Trigger? #1249

Closed 05vald0 closed 1 year ago

05vald0 commented 1 year ago

Binding: Service Bus Trigger, programming model V2

I want to defer the input message of a Service Bus Trigger, since the message should only be marked as complete when another Service Bus Trigger finishes. However, the only example of message deferral in Python I've found uses a queue receiver. If I understand correctly, I cannot get the message via such receiver within the trigger, since the input message is locked by the trigger.

I tried setting the autoCompleteMessage attribute to false in host.json, and then settling the message outside of the trigger, but it did not make any difference, since the message was removed from the queue as soon as the trigger finished.

Is there a way to do this?

bhagyshricompany commented 1 year ago

the Azure Functions runtime does not provide a built-in mechanism for deferring messages within a Service Bus Trigger. The Service Bus Trigger in Azure Functions is designed to automatically complete the message after the function execution.

If you require message deferral capabilities, you may need to consider alternative approaches such as using a separate Azure Function or implementing a custom solution outside the scope of Azure Functions.

Please refer to the official Azure Functions documentation for the most up-to-date information on the capabilities and limitations of Service Bus Triggers in Azure Functions:

Azure Functions Service Bus Trigger Azure Functions Python developer guide https://learn.microsoft.com/en-us/azure/service-bus-messaging/message-deferral

ghost commented 1 year ago

This issue has been automatically marked as stale because it has been marked as requiring author feedback but has not had any activity for 4 days. It will be closed if no further activity occurs within 3 days of this comment.

bhagyshricompany commented 1 year ago

I hope you got the answer if not pls raise new request will work on that .Hence Closing. Thanks