Repository navigation
AsyncMonolith 11.0.0: one package, reliable processing, a smaller public API and a full test suite - #17
Merged
Conversation
- EF Core 10.0.1 -> 10.0.15 (pulls a patched System.Security.Cryptography.Pkcs via SqlClient) - Npgsql EF provider 10.0.0 -> 10.0.3 - Testcontainers 4.9.0 -> 4.17.0 (patched SSH.NET) - Pin MySqlConnector 2.6.2 in the MySql and MariaDb providers (Pomelo 9.0.0 pulls vulnerable 2.4.0) - Example API aligned to the same EF Core and Npgsql versions Restore now succeeds with NuGet audit enabled.
Tests that start databases through Testcontainers are tagged Category=Integration so the fast in-process tests can run on every change. The test workflow now runs fast tests on push and pull requests, and the integration tests only on manual dispatch. It also targets .NET 10 instead of .NET 8.
Package versions move from each project into Directory.Packages.props. No versions change.
The providers referenced the published AsyncMonolith 10.0.0 package, so changes to the core in this repo were not built into them or exercised by their tests. A plain ProjectReference still packs as a NuGet dependency on AsyncMonolith (checked with dotnet pack), so consumers keep a single copy of the core assembly. TestHelpers also stops bundling AsyncMonolith.dll inside its package and depends on the AsyncMonolith package instead, matching the providers.
Every package moves to its latest release that supports net10.0: Cronos 0.13.0, TimeProvider.Testing 10.11.0, Aspire 13.6.5, OpenTelemetry 1.21.0, ASP.NET Core components 10.0.15 and the container tools 1.23.0. Tests move from xunit v2 to xunit.v3 4.0.3 and run on Microsoft.Testing.Platform, selected in a new global.json that also pins the .NET 10 SDK. The VSTest-only packages (Microsoft.NET.Test.Sdk, xunit.runner.visualstudio, coverlet.collector) are removed. Test commands use --filter-trait / --filter-not-trait. Breaking for AsyncMonolith.TestHelpers users: it now depends on xunit v3, and ConsumerTestBase.InitializeAsync/DisposeAsync return ValueTask. Held back: Pomelo has no EF Core 10 release (still 9.0.0), and MySqlConnector stays on 2.x because Pomelo 9 does not support 3.0.
- Throw InvalidOperationException instead of System.Exception (CA2201) - Use source-generated LoggerMessage methods for processor logging (CA1848, CA1727) - Expose ConsumerRegistry lookups as get-only properties instead of public fields (CA1051) - Rename IScheduledMessageFetcher.Fetch's 'set' parameter (CA1716) - Build provider SQL with the invariant culture (CA1305) - Minor: static StartActivity, no explicit default initialiser
Generic payload parameters are renamed from V to TPayload (CA1715), and the fake clock parses its start time with the invariant culture.
- Pass TestContext.Current.CancellationToken to cancellable calls (xUnit1051) - Use Assert.Single with a predicate (xUnit2031) - Pin Testcontainers images instead of the obsolete default constructors - Properties instead of visible fields, static helpers, specific exceptions
Forward request cancellation tokens to the producer, fail fast when the connection string is missing, and treat EF migrations as generated code.
A Directory.Build.props sets the target framework, nullable, implicit usings and latest language version for every project, and turns on TreatWarningsAsErrors, the .NET analyzers in Recommended mode and code-style enforcement. The duplicated properties are removed from each project, and LangVersion moves from preview to latest. Also: - Remove the Microsoft.AspNetCore.Components.Web references, which the shared framework already provides (NU1510) - Suppress NU1608 for the MySQL/MariaDB projects: Pomelo has no EF Core 10 release yet, so that combination is untested - Suppress CA1707 in tests, whose names use underscores - Treat ASPIRE010 as a message in the example AppHost
SqliteTestHost runs the real producer, schedule service, fetchers and processors over an in-memory SQLite database with a fake clock, so batch behaviour can be tested in milliseconds without Docker. ConsumerProcessingTests covers one batch: success removes the message, availability, retry delay, poisoning (fields copied, never retried), attempt overrides, timeouts, batch size, oldest-first ordering, independent consumers of one payload, rails, unknown consumer types, null payloads, and parallel versus sequential execution. TestConsumerInvocations becomes thread-safe, since parallel consumers in a batch increment it concurrently, and records invocation order.
Covers next-occurrence calculation across time zones (and that it is strictly after now), the required seconds field, unknown time zones, UpdateSchedule/UpdatePayload, the schedule service (stored fields, validation before save, DeleteByTag, DeleteById) and the scheduled message processor (producing for every consumer, advancing to the next occurrence, batch size). Two tests document current behaviour that callers should know about: scheduling the same tag twice creates two schedules, and missed occurrences are not caught up.
Covers the rows Produce writes (one per consumer, shared insert id, timestamps, rails), explicit availability and insert ids, duplicate insert ids rejected by the unique index, ProduceList insert ids, and that a produced message is only written when the caller saves, and is discarded or kept with the caller's transaction.
Covers settings validation and its boundaries, consumer attributes read at registration and their fallbacks, unknown consumer and payload names, rail lookup, id generation, BaseConsumer payload handling, and the services and background processors AddEfAsyncMonolith registers.
ProcessNext<TDbContext, TConsumer> filtered messages by the DbContext's type name instead of the consumer's, so it never found a message and always returned null. It now filters by and resolves TConsumer. The generic parameter is renamed from TPayload to TConsumer to match what it is. Adds tests for the TestHelpers package: the fake producer and schedule services, AssertSingleConsumerMessage/GetConsumerMessages, ProcessNext (both overloads) and Process.
HostedProcessingTests starts a real generic host with AddEfAsyncMonolith, the background processors (one per rail plus the scheduler) and the real clock over a SQLite database file. It checks that a produced message is consumed, that every rail is consumed, that a failing message is poisoned, and that a schedule fires repeatedly. They take about 4 seconds in total, so they run with the fast tests.
The consumer processor held one transaction open while every consumer in the batch ran. On SQLite that transaction holds the database's only write lock, so a consumer that wrote to the database waited for the lock, timed out and was eventually poisoned. Most real consumers write. Batches are now processed in three steps: 1. Claim: one short transaction fetches the batch, counts the attempt and leases each message by moving AvailableAfter past the consumer timeout plus a 30 second grace period. The provider fetchers still lock rows while claiming. 2. Consume: consumers run outside any transaction. 3. Complete: each message is deleted, rescheduled or poisoned in its own short write, guarded by its lease so a message another processor has since re-claimed is left alone. If a processor stops mid-batch, its messages become available again when the lease expires, and the interrupted attempt counts towards max attempts. Also disposes the per-message timeout CancellationTokenSource and records the exception's type name in the trace instead of the literal "ex". Tests cover a writing consumer (in a batch and on a running host), lease expiry after a crash, and a completed message whose lease was taken over.
Messages were keyed by the short class name. Two payloads with the same
class name in different namespaces were silently merged, so each was
delivered to the other's consumers and deserialized into the wrong type.
- [ConsumerPayloadName("...")] and [ConsumerName("...")] set the name
stored in payload_type and consumer_type. Without them the class name is
still used, so stored messages and schedules keep working.
- AsyncMonolithNames.ForPayload/ForConsumer resolve names for the core,
every provider and TestHelpers.
- Registration fails at startup when two payloads or two consumers share a
stored name, naming both types and the attribute that fixes it.
Tests cover default and attribute names, blank names, producing,
consuming and scheduling named messages, and clashes using types emitted
at runtime.
A host and its modules (for example MiniCMS and an LMS module) each need consumers, but Add*AsyncMonolith registers the background processors and can only be called once. - AddAsyncMonolithConsumers(assemblies) and AddAsyncMonolithConsumersFromAssemblyContaining<T>() register a module's consumers before or after the host's call. Registering an assembly twice is harmless. - The consumer registry is built and validated when it is first resolved (at host start), so checks for payloads without consumers and for name clashes cover every module together. - Processor rails are read from the registry at start. The host always runs the per-rail processor factory, and ConsumerRegistry.RailIds falls back to rail 0 when there are no consumers. Tests cover modules registered before and after the host, duplicate registration, a payload with no consumer, rails across modules, and a running host whose consumers come only from a module registration.
Retries used a fixed AttemptDelay, so an outage of a few minutes (for example an SMTP server) poisoned every message in under a minute. Poisoned messages had no record of why they failed, and could only be retried by editing the database. - Backoff: the first retry waits AttemptDelay seconds and each later retry doubles, capped by the new MaxAttemptDelay setting (default 300 seconds, never below AttemptDelay). Settings.GetRetryDelay(attempts) gives the delay. - Errors: consumer_messages and poisoned_messages gain a nullable last_error column holding the exception type and message (at most 2000 characters) or "Timed out after N seconds." Hosts must add the column; the SQL schemas include it. - IPoisonedMessageService (registered by every provider and by AddRealAsyncMonolithBaseServices): Count, List (newest first, paged), Retry, RetryAll and Delete. Retrying moves a message back to the queue with its attempts reset. Changes are saved immediately. Tests cover the backoff sequence and caps, recorded errors and timeouts, errors kept on poisoned messages, and every service operation.
- IScheduleService.EnsureSchedule creates or updates the schedule with a tag, so it can run at every startup. The next occurrence only moves if the expression or timezone changed, and duplicates with the same tag are removed. FakeScheduleService records it in the same way. - IQueueStatisticsService.Read returns available, waiting and poisoned message counts, the number of schedules, and how long the oldest due message has waited, for health checks. Registered by every provider and by AddRealAsyncMonolithBaseServices. Tests cover creating, re-ensuring after a restart, payload updates, recalculation on expression or timezone change, duplicate removal, required tags, the fake, and statistics for empty, mixed and leased queues.
The hand-written schemas for hosts that don't use EF migrations had drifted from the model: - rail_id was missing from consumer_messages and poisoned_messages, so rail filtering failed against those databases - trace_id and span_id were NOT NULL, but the producer writes null when no trace is active, so those inserts failed Both are fixed in all four schemas, alongside the new last_error column. The example API gets a migration for rail_id and last_error. SchemaFileTests now parses each schema and checks every model column exists with matching nullability, so the files can't drift again.
Since messages are leased while processing, a poisoned message's AvailableAfter held the lease expiry, which means nothing once it is poisoned. The claim now remembers when each message became due, and the poisoned message keeps that, as it did before leasing. Found by the integration tests on CI; the fast poisoning test now checks it too.
- One Version in Directory.Build.props replaces the per-project PackageVersion values (core and TestHelpers were 10.0.0, providers 10.0.1). Providers and TestHelpers now depend on the core package at that same version. - A single publish workflow replaces the five per-package ones. Those pinned the .NET 8 SDK, which cannot build net10.0, and there was none for the core package or MariaDb. The new one builds, runs the fast tests, packs all seven packages and pushes them (skipping existing versions), on a v* tag or manual dispatch. Packing was checked locally. - Test and publish workflows read the SDK from global.json; SonarCloud uses current action versions. - docs/releases.md describes 10.1.0, its migration and breaking changes. - .DS_Store files are no longer tracked and are ignored.
Nothing registered or referenced it, but it was public, so it would have been a compatibility promise for code that never ran.
- No longer registers DbContext as an alias for the host's context. Nothing used it, and it changed what DbContext resolved to across the whole container. - Services, the producer and the fetchers use TryAdd, so a host can register its own implementation first. - TimeProvider defaults to TimeProvider.System; hosts no longer fail at runtime for not registering one. - Calling Add*AsyncMonolith twice throws, pointing to AddAsyncMonolithConsumers, instead of starting duplicate processors.
The EF provider added messages to the caller's DbContext, so they were written on SaveChanges and a duplicate insert id threw. The Postgres, SQL Server, MySQL and MariaDB providers ran their INSERT immediately and silently skipped duplicates. With those four, a message was written even when the caller's own save failed, unless they opened a transaction themselves, so the outbox guarantee depended on the provider. All providers now share one internal producer: - Messages are added to the caller's DbContext and written on SaveChanges, in the same transaction, on every database. - With an insert id, consumers that already have a pending message with it (saved, or added to this DbContext) are skipped. Producers racing in separate transactions are stopped by the unique index, and the second SaveChanges throws. - The five provider producer classes are removed. Providers now only supply their fetchers. The producing guide drops the "wrap it in a transaction" workaround and explains deduplication. Tests cover the outbox on SQLite and, as integration tests, on every database: skipping, duplicates before saving, partial duplicates, re-producing after consumption, and racing producers.
The EF fetcher reads candidate rows without locking them, so two app instances could claim and process the same message, and a schedule could fire twice for one occurrence. The provider fetchers lock rows, but nothing in the claim itself guarded against it. - A message is claimed with an update that only matches if its attempts and due time are unchanged since it was read. A processor that loses the race skips the message. - A schedule moves to its next occurrence with an update that only matches its current due time, and its message is produced only if that update won. Tests give a second processor a stale read (as another instance would have) and check it neither re-processes a message, nor claims a leased one, nor fires a schedule twice. These fail against the previous code. Two real hosts sharing a database also consume 60 messages exactly once.
Fetchers ordered only by created_at, which is stored in whole seconds, so messages created in the same second came back in whatever order the database chose. Every fetcher now breaks ties by id (and the EF schedule fetcher by id after due time), so the order is stable. The consuming guide now says plainly what is and isn't guaranteed: only roughly oldest first; retries run after newer messages; and Sequential execution only means one at a time within a batch on one processor, not ordered delivery.
The release breaks existing users, so the major version moves to 11 and follows Semantic Versioning from here instead of tracking .NET. AsyncMonolith.MySql and AsyncMonolith.MariaDb pack as 11.0.0-preview.1 until Pomelo supports EF Core 10 and they run in the integration tests.
Consumers had to inherit BaseConsumer<T> and could not see which message they were handling, so idempotency checks and useful logging were not possible. Adding that later would break every consumer, so it changes now: - Consumers implement IConsumer<TPayload> with Consume(payload, ConsumeContext context, CancellationToken). - ConsumeContext carries MessageId, DeduplicationKey, Attempt (from 1), MaxAttempts, IsLastAttempt, CreatedAt, ConsumerName, PayloadName and TraceId. - BaseConsumer<T> and the non-generic IConsumer.Consume(ConsumerMessage) are removed. IConsumer remains as an empty marker for constraints. - Registration finds classes implementing IConsumer<T>; a class that implements it for two payloads fails at startup. - TestHelpers constraints and helpers use IConsumer<TPayload>. Every test consumer, the example API and the docs are converted. Tests cover the context's fields, attempt numbering across retries, the shared deduplication key and the two-payload error.
- AsyncMonolithSettings becomes AsyncMonolithOptions, configured through the standard options pattern. Its values are copied by the framework instead of field by field, so new options can't be forgotten. - Times are TimeSpans, ending the mix of seconds and milliseconds: AttemptDelay, MaxAttemptDelay, DefaultConsumerTimeout, IdlePollInterval (was ProcessorMaxDelay, ms) and BusyPollInterval (was ProcessorMinDelay, ms). ProcessorBatchSize is BatchSize. The duplicate Default instance is removed. - Validation runs when the host starts (ValidateOnStart) and reports every invalid option, prefixed "AsyncMonolith:". - Add*AsyncMonolith returns an AsyncMonolithBuilder with BindConfiguration(section) and AddConsumers(...). The obsolete overloads taking an Assembly are removed, and the providers' entry points are documented. - [ConsumerTimeout] exposes Seconds instead of Duration. Tests cover each invalid option, boundaries, defaults, a host that refuses to start with invalid options, and binding from configuration over values set in code.
- Produce takes a TimeSpan? delay, or a DateTimeOffset availableAt, instead of an absolute Unix-seconds long. Future times are rounded up to whole seconds so a message is never consumed early; past times mean now. Negative delays are rejected. ProduceList takes an IEnumerable. - insertId is now deduplicationKey (and InsertId is DeduplicationKey), still stored in insert_id. - Chron is spelled Cron: CronExpression, CronTimeZone and the cronExpression and timeZone parameters. Columns are unchanged. - TK generic parameters are TPayload, and ConsumerInstanceExecutionMode is ConsumerExecutionMode. - Produce(ScheduledMessage) leaves IProducerService. The scheduler uses the internal producer directly, so a host's own IProducerService can't stop schedules from firing. - FakeProducerService implements the new interface and mirrors the deduplication behaviour. Tests cover delay rounding, immediate messages produced mid-second, future and past times, and negative delays. No migration is needed.
Missed by the previous commit because the file also has unrelated local edits.
Every public type is a compatibility promise, and many existed only to wire the library together. Now internal: - ConsumerRegistry, the consumer and scheduled message processors, and the processor factory - IConsumerMessageFetcher, IScheduledMessageFetcher and every provider's fetchers - ScheduleService, PoisonedMessageService, QueueStatisticsService and AsyncMonolithIdGenerator (use the interfaces) - AsyncMonolithInstrumentation.ActivitySource (the name constants stay public for OpenTelemetry) and ScheduledMessage's scheduling methods FakeProducerService's constructor is internal; AddFakeAsyncMonolithBase Services creates it. Providers grant the test project access to their internals, as the core already did. PublicApiTests lists the types each package exports, so any change to the public surface has to be made on purpose. Each provider now exports only its StartupExtensions.
… prefix Hosts had to declare DbSets for AsyncMonolith's three tables and could not move them out of the way of their own, which matters when the library shares a database with an app like MiniCMS. - ConfigureAsyncMonolith maps consumer_messages, poisoned_messages and scheduled_messages itself (tables, keys and the unique index), so DbSets are optional. It takes an optional Schema and TablePrefix. - The [Table] attributes on the entities are removed; the fluent mapping is the only source of table names. - The PostgreSQL, SQL Server, MySQL and MariaDB fetchers read the quoted, schema-qualified table name from the model instead of hard-coding it. The core now references EF Core Relational for this, and the MySQL and MariaDB projects reference it directly (Pomelo still caps it at 9). - IPoisonedMessageService.List returns PoisonedMessageInfo records with DateTimeOffset times instead of storage entities. - MySQL and MariaDB's NoWarn no longer drops the inherited list. Tests cover the default table names, a DbSet-free host context with prefixed tables running end to end on SQLite, and (as integration tests) a custom schema on PostgreSQL and SQL Server.
- AsyncMonolithOptions.SerializerOptions sets the JsonSerializerOptions used to store and read payloads (producer, schedules, consumers and TestHelpers' processor). Null keeps System.Text.Json's defaults, so stored payloads are unaffected. - Cron expressions may have 5 fields (minute precision) or 6 (seconds first); previously only 6 were accepted, which surprised anyone using standard cron. Tests cover the default payload format, custom options for storing and consuming (camelCase names, string enums) and for schedules, 5- and 6-field expressions, and wrong field counts.
The PostgreSQL, SQL Server, MySQL and MariaDB packages referenced a database driver only to build SQL parameters. MySQL and MariaDB pulled in Pomelo, which has no EF Core 10 release, plus a pinned MySqlConnector. - Every fetcher passes its values as EF positional parameters, so the packages depend only on AsyncMonolith and EF Core Relational. The host chooses its EF provider (for MySQL, Oracle's MySql.EntityFrameworkCore or Pomelo once it supports EF Core 10). - Schedule fetchers on PostgreSQL, MySQL and MariaDB now order by due time, then id; they had no ORDER BY. - SQL Server fetchers add UPDLOCK. ROWLOCK, READPAST alone does not hold row locks in a plain SELECT, so batches weren't actually locked. - Tests use Oracle's MySql.EntityFrameworkCore 10.0.12, and the MySQL and MariaDB integration tests are switched back on.
The scheduler processed a batch in one transaction, so a single schedule that couldn't be evaluated (an invalid cron expression or time zone, or no future occurrence) or whose payload had no registered consumers (for example after a module was removed) rolled the batch back on every poll, and no schedule fired again. Each schedule is now handled on its own: - One that can't be evaluated is logged (event 6) and checked again in an hour, so it neither blocks the batch nor floods the log. - One whose payload has no consumers moves to its next occurrence and logs the skipped occurrence (event 7). The schedule is kept, so it works again once the consumer is back. Tests cover a bad expression, a bad time zone and a payload without consumers, each alongside a healthy schedule that keeps firing.
Consumer timeouts relied on the consumer honouring its cancellation
token. One that didn't held up its whole rail for as long as it ran,
and its lease could expire meanwhile, letting the message run again
elsewhere.
The processor now stops waiting two seconds after the timeout, records
the attempt as failed ("Timed out after N seconds and did not stop when
cancelled."), logs event 8, and carries on with the batch. The abandoned
task's eventual failure is observed so it isn't reported as unobserved.
The docs say to pass the token to everything a consumer awaits.
The test's consumer ignores its token for 20 seconds; the batch finishes
in about 3 and the next message is still consumed.
The only index was the unique (insert_id, consumer_type) one, so finding due messages, due schedules and schedules by tag scanned whole tables, getting slower as they grew. The model adds indexes on consumer_messages (rail_id, available_after), scheduled_messages (available_after) and (tag), and poisoned_messages (created_at). The four SQL schemas and the example migrations include them, and SchemaFileTests now checks every model index is in every schema file.
Each processor logged an error every poll interval (one second by default) for as long as the database was unavailable. After repeated failures the wait now doubles from the idle interval up to 30 seconds, and resets after the next successful batch. Shutdown no longer logs a batch failure for the cancellation it causes, and the wait uses the injected TimeProvider.
There was no way to see throughput, failures or backlog without querying the tables. AsyncMonolith now publishes System.Diagnostics.Metrics on the async_monolith meter (AsyncMonolithInstrumentation.MeterName), created from the host's IMeterFactory when there is one: - messages.produced (payload_type, consumer_type) - messages.consumed, messages.failed, messages.poisoned (consumer_type) - consume.duration in seconds (consumer_type, outcome) - messages.lag: seconds from due to claimed (consumer_type) - schedules.fired (payload_type) Completing a message now reports its outcome (consumed, retrying, poisoned, or lease lost) so the counters are exact. The OpenTelemetry guide lists the metrics. Tests listen to each host's own meter and check every instrument, and that the host's meter factory is used.
Poisoned messages were kept forever unless deleted by hand. AsyncMonolithOptions.PoisonedMessageRetention (null by default, so nothing changes unless set; at least one hour) deletes poisoned messages older than the retention, measured from when they were last due. The scheduled message processor runs the cleanup at most once an hour. Tests cover deletion, retention off, the hourly limit and validation. The release notes and consuming guide describe the new behaviour.
They no longer depend on Pomelo, and their integration tests now pass on CI against MySQL 8.4 and MariaDB 11.8 using Oracle's MySql.EntityFrameworkCore (107 integration tests, none skipped).
Three app instances share one PostgreSQL, SQL Server, MySQL or MariaDB database and process 1,000 messages, with every tenth failing its first attempt. Each message must succeed exactly once, the failing ones must be attempted exactly twice, and the queue must end empty with nothing poisoned. It runs with the integration tests. TestDbContainerBase.AddDb takes IServiceCollection so a generic host can use it.
The packages had no licence expression or README and repeated their metadata in every project. Directory.Build.targets now sets, for the seven published packages: - the Apache-2.0 licence expression, copyright, repository, docs site, release notes link, icon and tags - PACKAGE.md as each package's README (install, packages, quick start) - SourceLink repository details, embedded untracked sources, snupkg symbol packages and deterministic builds on GitHub Actions - package validation (with a note to add the 11.0.0 baseline once it is published) Each project keeps only its id, title and a clearer description, and still generates its XML documentation file, which is in the package.
Coverage of the fast tests showed untested paths. New tests cover: - the consumer's trace continuing the producer's (parent span) - a running host recovering once its database becomes available - a lost lease on the poisoning path (nothing poisoned, message kept) - a cron expression that never occurs, both when scheduling and stored - the builder's AddConsumersFromAssemblyContaining - quoted, prefixed table names and the error when ConfigureAsyncMonolith wasn't called - ConsumerTestBase and the message assertion helpers in TestHelpers The time zone null checks were dead (the lookup throws instead) and are removed; a cron expression with no future occurrence now says so. Fast tests now cover 99% of the core's lines (96% of branches) and 93% of TestHelpers' lines. The test workflow collects Cobertura coverage with Microsoft.Testing.Extensions.CodeCoverage and uploads it.
- Internals describe the claim, consume and complete cycle, leasing, conditional claims, schedule isolation and the polling backoff, and no longer mention removed APIs or the old startup exception. - Warnings explain at-least-once delivery, the cancellation token, rails for slow consumers, ordering, and when AsyncMonolith.Ef is enough. - The scheduling guide describes cron occurrences and per-schedule handling; the TestHelpers example uses the options lambda. - The README and docs consumer example had a mismatched constructor name and awaited in a non-async method; both are fixed.
It had been failing at authentication on every run, including on main, and the strict build settings and test coverage reports now cover the same ground.
None of the database packages referenced a driver any more; each only held a couple of SQL statements. They are merged into the core: - AddAsyncMonolith<TDbContext>() replaces AddEfAsyncMonolith, AddPostgreSqlAsyncMonolith, AddMsSqlAsyncMonolith, AddMySqlAsyncMonolith and AddMariaDbAsyncMonolith. - The fetch SQL is chosen from the DbContext's EF Core provider: PostgreSQL (Npgsql), SQL Server, and MySQL/MariaDB (Oracle's provider or Pomelo, which share the same SQL) lock rows; anything else, such as SQLite, uses LINQ without locks. - AsyncMonolith.Ef, .PostgreSql, .MsSql, .MySql and .MariaDb are removed from the solution and the publish workflow, which now packs AsyncMonolith and AsyncMonolith.TestHelpers. - README, package README, quickstart, warnings and release notes describe one package and how the database is detected. SqlDialectTests checks the detection for Npgsql, SQL Server, Oracle's MySQL provider, SQLite, Pomelo, InMemory and unknown providers. The integration and load tests now exercise the merged fetchers on every real database.
- Each test database container is tracked before it starts, so one that fails to start is still cleaned up and its real error is reported (it surfaced as a NullReferenceException before). - The harness waits until the database accepts a connection before a test uses it. MySQL can refuse connections for a moment after the container reports ready, which failed one test in a long local run. - The tests guide explains running SQL Server containers on Apple Silicon. A full local run (fast and integration tests against PostgreSQL, SQL Server, MySQL and MariaDB) passed 325 of 326 before these fixes; the one failure was that MySQL startup race, and the test passes on rerun.
Timmoth
marked this pull request as ready for review
November 20, 2026 07:00
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Prepares AsyncMonolith 11.0.0. It's a breaking, migration-required release, and the major version now follows SemVer instead of .NET. Each commit is small and builds and passes the tests on its own.
docs/releases.mdhas the full upgrade notes.Behaviour
SaveChangesin your transaction. Deduplication skips consumers with the key already pending.last_error, plusIPoisonedMessageService,IQueueStatisticsServiceandIScheduleService.EnsureSchedule.API
IConsumer<TPayload>and receive aConsumeContext(message id, attempt, max attempts, deduplication key, times, names).BaseConsumeris removed.AsyncMonolithOptionsuses the standard options pattern:TimeSpanvalues, validation when the host starts, and.BindConfiguration(...).Producetakes aTimeSpandelay or aDateTimeOffset.insertIdbecomesdeduplicationKey, andChronbecomesCron.ConfigureAsyncMonolith()maps the tables itself, so DbSets are optional, with an optional schema and table prefix.[ConsumerPayloadName]and[ConsumerName]), with name clashes failing at startup.AddAsyncMonolithConsumersis added for modules.PublicApiTestspins every exported type.One package
AsyncMonolith.Ef,.PostgreSql,.MsSql,.MySqland.MariaDbare merged intoAsyncMonolith, andAddAsyncMonolith<TDbContext>()replaces the fiveAdd*AsyncMonolithmethods.AsyncMonolithandAsyncMonolith.TestHelpers. The SonarCloud workflow is removed.Production hardening
MySql.EntityFrameworkCore. SQL Server fetches now really lock rows (UPDLOCK).async_monolithmeter. OptionalPoisonedMessageRetention.Maintenance
11.0.0-preview.1.rail_id, nullable trace columns,last_error), and a test now keeps them in line with the model.Testing
--parallel none.Needs the maintainer