rebus-org / Rebus.AzureQueues

:bus: Azure Storage Queues transport implementation for Rebus
https://mookid.dk/category/rebus
Other
7 stars 5 forks source link

Support SAS with lifetimes #1

Closed asleire closed 4 years ago

asleire commented 4 years ago

Problem

Azure Queue Storage supports SAS (Shared Access Signature) as a way to limit access to queues within an Azure Storage Account. These SAS have a specified lifetime. While I couldn't find a constraint on lifetimes, they are recommended to be short-lived.

The current implementation of AzureStorageQueuesTransport requires an instance of CloudStorageAccount, which in turn requires credentials, in this case a SAS.

When using a SAS with a short lifetime, I would have to recreate the IBus-instance every time the SAS expires

Proposed solution

Add an additional constructor for AzureStorageQueuesTransport which instead of a CloudStorageAccount-parameter, takes a Func<string,Task<CloudQueue>>-parameter (or an interface describing it) for obtaining CloudQueue-references.

This would allow users to manage CloudQueue-references themselves without any breaking changes

I can make a PR if you want 🙂