dapr / components-contrib

Community driven, reusable components for distributed apps
Apache License 2.0
548 stars 480 forks source link

Azure Service Bus Queues retry policy #2900

Open GianvitoDifilippo opened 1 year ago

GianvitoDifilippo commented 1 year ago

/area runtime

Hello, I'm currently working with the Azure Service Bus Queues component, and I need to set a retry policy. Unfortunately, I couldn't find a way to do it using the available metadata, as described here: the retries are happening, but there's no delay between them. I tried using the retry policies, but I would prefer to have the bus handle the retries instead of the sidecar; additionally, I also need the "DeliveryCount" header which doesn't get incremented if I use the sidecar's retry policies.

ItalyPaleAle commented 1 year ago

Are you using the binding or pubsub component?

GianvitoDifilippo commented 1 year ago

I'm using the pubsub component.

berndverst commented 1 year ago

Can you link to the service bus documentation for the retry policies and the header you want? Then we can figure out whether this is possible to be added.

GianvitoDifilippo commented 1 year ago

Hi, I was a bit imprecise in my request. Initially, I thought the retry policy was implemented by the bus itself. However, after conducting some research, it seems like it's the client should handle that, as stated here; to confirm this, I also examined the source code of the native library Azure.Messaging.ServiceBus. I was wondering if it's feasible to incorporate a similar retry mechanism within the sidecar, allowing us to define the retry interval and maybe other retry policy parameters. This would narrow the gap that exists with the native library.

github-actions[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had activity in the last 30 days. It will be closed in the next 7 days unless it is tagged (pinned, good first issue, help wanted or triaged/resolved) or other activity occurs. Thank you for your contributions.

berndverst commented 1 year ago

We too are using a native library for service bus - but written in Go. The retry options were actually hard to find in the Dotnet library.. I could only easily find this in this advanced configuration sample: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/servicebus/Azure.Messaging.ServiceBus/samples/Sample13_AdvancedConfiguration.md

In the Go SDK there is this: https://github.com/Azure/azure-sdk-for-go/blob/f7ff2bd86532251f6f95a842fddf225635919a18/sdk/messaging/azservicebus/example_client_test.go#L45-L63

These are the only retry options. https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/messaging/azservicebus#example-NewClient-ConfiguringRetries

For Dapr 1.12 we can consider exposing these. Would that be sufficient?