Hangfire compatibility acceptance
Run Hangfire.Redis.StackExchange 1.12.0 on Respire by injecting the
StackExchange.Redis adapter into RedisStorage. Tested against real Redis
on .NET 8 and .NET 10 with RESP2 and RESP3 (package commit
da8e39a).
dotnet add package Respire.StackExchangeCompat
using Respire.StackExchangeCompat;
// options is your RespireOptions, for example RespireOptions.Parse("localhost:6379").
await using var multiplexer = RespireConnectionMultiplexer.Create(options);
var storage = new Hangfire.Redis.StackExchange.RedisStorage(multiplexer,
new Hangfire.Redis.StackExchange.RedisStorageOptions
{
Db = options.Database,
UseTransactions = true,
});
- Keep the multiplexer alive until Hangfire workers and storage operations finish. Hangfire borrows it; the adapter owns its native clients.
- Pass the multiplexer, not a connection string. A connection string makes
RedisStoragecreate StackExchange.Redis instead.
What is tested
tests/Respire.Hangfire.Acceptance.Tests ports 93 of the 96 active upstream tests, plus two worker lifecycle tests.
| Upstream class | Facts exercised |
|---|---|
RedisConnectionFacts | 18 |
RedisWriteOnlyTransactionFacts | 25 |
RedisFetchedJobFacts | 16 |
RedisLockFacts | 4 |
FetchedJobsWatcherFacts | 7 |
ExpiredJobsWatcherFacts | 5 |
RedisSubscriptionFacts | 3 |
RedisStorageFacts | 1 |
RedisStorageOptionsFacts | 1 |
RedisTest | 1 |
DeletedStateHandlerFacts | 3 |
FailedStateHandlerFacts | 3 |
ProcessingStateHandlerFacts | 3 |
SucceededStateHandlerFacts | 3 |
- Transaction, fetched-job, watcher, and lock tests run on Redis. Argument-validation and state-handler tests use upstream mocks, so they do not prove Redis behavior.
- The worker lifecycle tests run a real
BackgroundJobServerwithUseTransactionsbothtrueandfalse: enqueue, execute, check the succeeded state, and shut down. - The source notice lists each method, adaptation, and the upstream LGPLv3 notices.
Excluded:
DbFromConnectionStringIsUsed,PasswordFromToStringIsNotShown, andPasswordFromWriteOptionsToLogIsNotShownuse string constructors that create StackExchange.Redis, so they cannot test the adapter.AcquireFromNestedTaskis disabled upstream (the package uses thread-local lock ownership).- The upstream expired-job deletion test writes the misspelled key
succeded, so it does not prove cleanup of thesucceededlist.
Limitations
- Supported members are listed in the migration guide. Unsupported members and flags throw
NotSupportedException. - Not covered: other Hangfire package versions, Redis Cluster or Sentinel, every dashboard query, every Hangfire feature, and general StackExchange.Redis parity.
ListRightPop,HashExists,SortedSetRank,SetContains, and newerStringSetoverloads appear only in upstream test setup and are not part of the supported surface unless the migration guide lists them.