HangfireIO / HangfireIO/Hangfire

Consider making attributes non-sealed

Open
#1,932 5 comments 2 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
10.1k
Forks
1.8k
Avg merge
1h 19m
Merged PRs (30d)
1

Description

This issue was previously discussed in #503. TL;DR: job filter attributes such as `QueueAttribute` are sealed and it makes it unnecessarily hard to use Hangfire in some cases.

There are many use-cases for inheritable job filters:

* Let end-users create short-hands for common scenarios
* Imagine a `[CommonQueue]` and `[SpecialQueue]` being short for `[Queue("common")]` and `[Queue("special")]`
* Let end-users extend the behavior of existing filters, rather then creating new ones
* Changing the order of the Queue attribute
* Running custom code before and/or after the filter is invoked (this does not even require virtual functions)
* Let end-users enforce code quality policies
* Imagine a "no direct 3rd-party code references" policy that lets you better assess feature impact and scope

Note that it is of course still possible to implement all use cases without inheriting from existing filters. You could wrap (aggregate) attribute classes, or copy/paste code, or even recompile Hangfire itself (e.g. to fix internal references in ctors in Ace). Since the project is open-source and you also provide source code for closed-source components, everything is effectively public but inconvenient to use. It would be much easier to just have the filter classes un-sealed.

Contributor guide

Open the contributing guide

Research direction

Start by locating the job filter attribute classes mentioned in the issue, including QueueAttribute, and review the earlier discussion in #503. Determine which sealed filter attributes are in scope and check existing tests; done means the relevant attributes can be inherited without breaking current filter behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.