Skip to content

Hangfire jobs enqueued by v0.x cannot run by v1.x #1109

@hainguyenthanh

Description

@hainguyenthanh

After migrating EventFlow from version 0.83.4713 to version 1.2.1, many background jobs enqueued by the old version of EventFlow.Hangfire package failed to execute with the new version of the same package. The error was

System.InvalidOperationException: The type EventFlow.Hangfire.Integration.IHangfireJobRunner does not contain a method with signature ExecuteAsync(String, String, Int32, String, String)

at Hangfire.Storage.InvocationData.<>c.b__33_0(MethodDeserializerCacheKey key) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\InvocationData.cs:line 350

at Hangfire.Storage.InvocationData.CachedDeserializeMethod(Func`2 typeResolver, String typeName, String methodName, String parameterTypes, Type& type, MethodInfo& methodInfo) in C:\projects\hangfire-525\src\Hangfire.Core\Storage\InvocationData.cs:line 335

at Hangfire.Storage.InvocationData.DeserializeJob() in C:\projects\hangfire-525\src\Hangfire.Core\Storage\InvocationData.cs:line 96

Comparing the two versions of the IHangfireJobRunner interface, I saw the following changes
IHangfireJobRunner at v0.83.4713

namespace EventFlow.Hangfire.Integration
{
    public interface IHangfireJobRunner
    {
        [DisplayName("{0}")]
        Task ExecuteAsync(string displayName, string jobName, int version, string job);

        [DisplayName("{0}"), UseQueueFromParameter(4)]
        Task ExecuteAsync(string displayName, string jobName, int version, string job, string queueName);
    }
}

IHangfireJobRunner at v1.2.1

namespace EventFlow.Hangfire.Integration
{
    public interface IHangfireJobRunner
    {
        [DisplayName("{0}")]
        Task ExecuteAsync(string jobName, int version, string job);
    }
}

There are breaking changes: the new interface is completely different from its old version. Therefore, background jobs enqueued by the old version cannot run by the new version. Unfortunately, this breaking change was not mentioned in the Migration guide 0.x to 1.x.

I would greatly appreciate it if anyone could propose solutions, as this issue requires immediate attention. Thank you in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions