Custom JobFilterAttribute

The original post I had here was with me looking at an issue that was just a symptom of a different issue.

internal class UseShopNameAsQueueAttribute : JobFilterAttribute, IElectStateFilter
{
    public string ShopName;

    public UseShopNameAsQueueAttribute()
    {
        this.ShopName = Settings.Default.InternalShopName.ToLower();
    }

    public void OnStateElection(ElectStateContext context)
    {
        var enqueuedState = context.CandidateState as EnqueuedState;
        if (enqueuedState != null)
        {
            enqueuedState.Queue = ShopName;
        }
    }
}

@warcode, just curious, what was the issue?

Somebody had started an additional hangfire server with the same storage database as my existing one. It seemed like the queues were failing, but it was just the other server not knowing what the assembly was.

1 Like