elsa-core icon indicating copy to clipboard operation
elsa-core copied to clipboard

Unable to install Elsa.Rebus.AzureServiceBus on .NET6 + workaround

Open MariusVuscanNx opened this issue 3 years ago • 1 comments

We had some issues with installing Elsa.Rebus.AzureServiceBus package. The errors are present in the following picture:

image

The problem is that the package has a dependency on Rebus.AzureServiceBus 9.0.8. This package has dependencies on older versions of some packages. In .NET 6 those packages have newer versions. Therefore, installing that package will result in a downgrade error message.

Workaround: We installed an older version of the Rebus.AzureServiceBus (8.1.5) package directly and constructed the middleware based on the one from Elsa.Rebus.AzureServiceBus. The code:

public static ElsaOptionsBuilder AddAzureServiceBus(this ElsaOptionsBuilder options, string connectionString)
        {
            return options
                .UseServiceBus(context =>
                {
                    var queueName = context.QueueName;

                    context.Configurer
                        .Transport(t =>
                        {
                            if (queueName.Length > 50)
                                queueName = queueName.Substring(queueName.Length - 50);

                            t.UseNativeDeadlettering();
                            var transport = t.UseAzureServiceBus(connectionString, queueName);

                            if (context.AutoDeleteOnIdle)
                                transport.SetAutoDeleteOnIdle(TimeSpan.FromMinutes(5));
                        });
                });
        }

MariusVuscanNx avatar Jul 06 '22 09:07 MariusVuscanNx

Thank you for providing the workaround!

sfmskywalker avatar Jul 11 '22 10:07 sfmskywalker