HangfireIO / Hangfire.Azure.ServiceBusQueue

ServiceBus Queue support for SQL Server job storage implementation
MIT License
58 stars 33 forks source link

Method 'Enqueue' in type 'Hangfire.Azure.ServiceBusQueue.ServiceBusQueueJobQueue' #15

Closed mchudinov closed 3 years ago

mchudinov commented 5 years ago

Method 'Enqueue' in type 'Hangfire.Azure.ServiceBusQueue.ServiceBusQueueJobQueue' from assembly 'Hangfire.Azure.ServiceBusQueue, Version=4.1.0.0, Culture=neutral, PublicKeyToken=null' does not have an implementation.

Got this error in .NET Core 2.2 project. Nuget package version Hangfire.Azure.ServiceBusQueue 4.1.0 What is the problem?

Here is the relevant code from ConfigureServices(IServiceCollection services) method

            var sqlStorage = new     SqlServerStorage(SqlServerConnectionString);
            Action<QueueDescription> configureAction = qd =>
            {
                qd.MaxSizeInMegabytes = 5120;
                qd.DefaultMessageTimeToLive = new TimeSpan(0, 1, 0);
            };

                sqlStorage.UseServiceBusQueues(ServiceBusConnectionString);
                sqlStorage.UseServiceBusQueues(ServiceBusConnectionString, "critical", "default");
                sqlStorage.UseServiceBusQueues(ServiceBusConnectionString, configureAction, "critical", "default");

            sqlStorage.UseServiceBusQueues(new ServiceBusQueueOptions
            {
                ConnectionString = ServiceBusConnectionString,
                Configure = configureAction,
                QueuePrefix = "my-prefix-",
                Queues = new[] { EnqueuedState.DefaultQueue },
                CheckAndCreateQueues = false,
                LoopReceiveTimeout = TimeSpan.FromMilliseconds(500)
            });

            GlobalConfiguration.Configuration.UseStorage(sqlStorage);

            services.AddHangfire(configuration => configuration
                .SetDataCompatibilityLevel(CompatibilityLevel.Version_170)
                .UseSimpleAssemblyNameTypeSerializer()
                .UseRecommendedSerializerSettings()
                .UseSqlServerStorage(SqlServerConnectionString, 
                new SqlServerStorageOptions
                {
                    CommandBatchMaxTimeout = TimeSpan.FromMinutes(5),
                    SlidingInvisibilityTimeout = TimeSpan.FromMinutes(5),
                    QueuePollInterval = TimeSpan.Zero,
                    UseRecommendedIsolationLevel = true,
                    UsePageLocksOnDequeue = true,
                    DisableGlobalLocks = true
                }));

            services.AddHangfireServer();
gregbowyer84 commented 4 years ago

Did you get around this problem?

gregbowyer84 commented 4 years ago

Anybody?

FortuneN commented 4 years ago

Anybody?

tobiasschittkowski commented 3 years ago

I have the same problem - the current implementation of Enqueue in this Repo is

https://github.com/HangfireIO/Hangfire.Azure.ServiceBusQueue/blob/392ea69420a02b4a8949619663accf1984c763b9/src/HangFire.Azure.ServiceBusQueue/ServiceBusQueueJobQueue.cs#L69

However, in the current Hangfire definition of the interface IPersistentJobQueue, this definition is only valid if Hangfire is compiled with the FEATURE_TRANSACTIONSCOPE flag

#if FEATURE_TRANSACTIONSCOPE
        void Enqueue(System.Data.IDbConnection connection, string queue, string jobId);
#else
        void Enqueue(
            System.Data.Common.DbConnection connection, 
            System.Data.Common.DbTransaction transaction, 
            string queue, 
            string jobId);
#endif

https://github.com/HangfireIO/Hangfire/blob/dab0f33d44dccbe7b41196c79d3d4016ab971a7d/src/Hangfire.SqlServer/IPersistentJobQueue.cs#L26-34

This flag is only enabled on net45, but not on net core:

`

full $(DefineConstants);FEATURE_TRANSACTIONSCOPE;FEATURE_CONFIGURATIONMANAGER` https://github.com/HangfireIO/Hangfire/blob/3c6d893023d5d7558d6098e80034865004b73786/src/Hangfire.SqlServer/Hangfire.SqlServer.csproj#L11
TiagoBrazSantos commented 3 years ago

I have the same problem here. Someone managed to solve? It seems to me the maintainers abandoned the project.