-
Couldn't load subscription status.
- Fork 22
Deprecate JournalOptions.Adapters property in favor of callback API #669
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deprecate JournalOptions.Adapters property in favor of callback API #669
Conversation
Fixes akkadotnet#665 The Adapters property created confusion by providing two competing patterns for configuring event adapters. This deprecates the property in favor of the unified callback pattern introduced in PR akkadotnet#662. Changes: - Mark JournalOptions.Adapters as [Obsolete] with clear migration message - Remove internal usage of the property (Adapters.AppendAdapters call) - Add regression test DeprecatedAdaptersPropertySpec that verifies: * Deprecated property is ignored and does not configure adapters * Callback pattern continues to work correctly * Uses #pragma warning disable to test deprecated API Benefits: - Single, consistent pattern for configuring adapters and health checks - Cleaner API surface with options containing only configuration data - Clear migration path with deprecation warning Migration: Before (deprecated): var options = new JournalOptions(); options.Adapters.AddWriteEventAdapter<Foo>(...); builder.WithJournal(options); After (recommended): var options = new JournalOptions(); builder.WithJournal(options, journal => journal.AddWriteEventAdapter<Foo>(...)); All 17 tests pass.
This PR Fixes Akka.Persistence.Sql Issue 552akkadotnet/Akka.Persistence.Sql#552 This PR resolves a critical bug in Akka.Persistence.Sql v1.5.51.1 where event adapters stop working when Root CauseThe dual registration pattern created by having adapters in BOTH places:
When Akka.Persistence.Sql calls the API twice (first with adapters for default journal, second for sharding journal), the HOCON prepend order causes the second call's config (without adapters) to take precedence over the first call's config (with adapters), even though they target different journal identifiers. Why This PR Fixes ItBy removing adapter serialization from ImpactThis is blocking Akka.Persistence.Sql v1.5.51.2 release. Users with cluster sharding + event tagging are currently broken on v1.5.51.1. Related: akkadotnet/Akka.Persistence.Sql#552 |
Fixes #665
Summary
The
Adaptersproperty onJournalOptionscreated confusion by providing two competing patterns for configuring event adapters. This PR deprecates the property in favor of the unified callback pattern introduced in PR #662.Problem
Having two ways to configure event adapters was:
Solution
[Obsolete]with clear migration guidance pointing to issue Deprecate JournalOptions.Adapters property in favor of unified callback API #665JournalOptions.Build()Changes
JournalOptions.cs:78- Added[Obsolete]attribute toAdapterspropertyJournalOptions.cs:105- RemovedAdapters.AppendAdapters(sb)callEventAdapterSpecs.cs:134-207- AddedDeprecatedAdaptersPropertySpecregression testBenefits
✅ Single, consistent pattern for configuring adapters and health checks
✅ Cleaner API surface - options contain only configuration data
✅ Clear migration path with deprecation warning
✅ No silent failures - deprecated property is truly ignored
Migration Example
Before (deprecated):
After (recommended):
Testing
All 17 persistence hosting tests pass, including new regression test that verifies:
#pragma warning disableto test deprecated API without warningsNote
This is Phase 1 of the deprecation plan. The property will be removed entirely in v1.6.0.