robinrodricks / FluentStorage

A polycloud .NET cloud storage abstraction layer. Provides Blob storage (AWS S3, GCP, FTP, SFTP, Azure Blob/File/Event Hub/Data Lake) and Messaging (AWS SQS, Azure Queue/ServiceBus). Supports .NET 5+ and .NET Standard 2.0+. Pure C#.
MIT License
263 stars 33 forks source link

Azure Servicebus: Migrate to new SDK and imeplement missing methods #44

Open GiampaoloGabba opened 10 months ago

GiampaoloGabba commented 10 months ago

Hello, the AzureServicebus plugin for FluentStorage is implemented with the package Microsoft.Azure.ServiceBus wich is deprecated since 2021. I cannot use it in any of my projects cause conflicts with outated references: Version conflict detected for System.IdentityModel.Tokens.Jwt. I

Also there are missing functionalities, in the wiki we have this:

IMessagePublisher queuePublisher = StorageFactory.Messages.AzureServiceBusQueuePublisher(
                       connectionString,
                       queueName);

IMessagePublisher topicPublisher = StorageFactory.Messages.AzureServiceBusTopicPublisher(
                       connectionString,
                       topicName);

IMessageReceiver queueReceiver = StorageFactory.Messages.AzureServiceBusQueueReceiver(
                       connectionString,
                       queueName,
                       peekLock);

IMessageReceiver topicReceiver = StorageFactory.Messages.AzureServiceBusTopicReceiver(
                       connectionString,
                       topicName,
                       subscriptionName,
                       peekLock);

But in realty only these methods are currently implemented: image

Plus i'm not 100% sure that sending directly to subiscriptions will work with the actual code.

I'm implementing a PR wich fixes everything and use the current, supported package.

Should my PR replace the current plugin (there would be breaking changes, is inevitable) or should i make a new package FluentStorage.Azure.Messaging.ServiceBus (wich is similar to the name of the new Microsoft package) e maintain the older for retrocompatibility?

GiampaoloGabba commented 10 months ago

Here the link to my fork

Need to write some more xml comments and integration test. I also added some utility method in the AzureServiceBusMessenger class to better handle queues, topics and subscriptions (to see those, we need to cast the messenger to IAzureMessagingServiceBusMessenger ).

If it sounds good to you i can prepare a PR

robinrodricks commented 10 months ago

Sounds excellent to me! Please make a PR asap!

We shall overwrite the old project. No need to make a new project. Less is better.

Please change the old project itself as required. I will release a major version package of it to indicate breaking changes.