Skip to content
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

Persistence Overhaul prior to Alpha 0.9.9 #496

Closed
jeremydmiller opened this Issue Mar 2, 2019 · 2 comments

Comments

Projects
None yet
1 participant
@jeremydmiller
Copy link
Contributor

jeremydmiller commented Mar 2, 2019

After spending some time in the message persistence code the past week, I think there's plenty of opportunities to streamline the existing code and eliminate duplication before moving on to more kinds of message persistence.

Saga, Outbox, & Durable Messaging:

By v0.9.9, the supported persistence options should be:

  1. Raw ADO.Net or Dapper and Postgresql
  2. Raw ADO.Net or Dapper and Sql Server
  3. EF Core with Postgresql
  4. EF Core with Sql Server
  5. Marten with Postgresql (of course)

Published Nugets & Projects

I hate the explosion of Nugets, but it might be necessary to pull this all off, so:

  1. Jasper.SqlServer (existing)
  2. Jasper.Marten (existing, but it'll be thinned down and take a dependency on Jasper.Postgresql)
  3. Jasper.Postgresql (new)
  4. Jasper.EntityFrameworkCore.Postgresql (new). Would depend on Jasper.Postgresql
  5. Jasper.EntityFrameworkCore.SqlServer (new). Would depend on Jasper.SqlServer

The two EF Core nugets should be very small, and may have some shared code via C# code file includes.

Refactoring/Restructuring Ideas

  • Reconsider the existing IEnvelopePersistor interface
  • Introduce a new EnvelopeDirection enum w/ Incoming/Outgoing/Scheduled/Deferred as values in place of the current string constants and values on Envelope.Status
  • Eliminate the duplication that exists today between the two SchedulingAgent implementations for Marten and Sql Server in favor of a single coordinating agent
  • The existing Marten SchedulingAgent code should work directly against Npgsql objects instead of bouncing through Marten's IDocumentSession in order to decouple the code from Marten and reuse w/ the EF Core and Dapper + Postgresql combination
  • New IEnvelopeStorage interface for usage within the new ScheduledAgent implementation
  • Postgresql & Sql Server implementations of IEnvelopeStorage
  • New Deferred status for outgoing messages that have a scheduled send. Replaces the hacked in implementation that's there now. Will require a new IMessagingAction inside of the ScheduledAgent
  • Split the Scheduled messages out from Incoming in the message persistence so they're in a separate table
  • Combine EnvelopeRetries into IDurabilityAgent????

@jeremydmiller jeremydmiller added this to the Persistence Alpha milestone Mar 2, 2019

@jeremydmiller

This comment has been minimized.

Copy link
Contributor Author

jeremydmiller commented Mar 5, 2019

Tasking

  • Eliminate IRetries in favor of Polly usage
  • Mark all existing SchedulingAgent support classes in the Sql Server library as [Obsolete]
  • Mark all existing SchedulingAgent support classes in the Marten library as [Obsolete]
  • Register the new IDurabilityAgent as an IHostedService
  • Add IEnvelopePersistor.CreateAgentStorage() that will build out a new IDurabilityAgentStorage
  • Convert the Sql Server scheduling agent code to IDurabilityAgentStorage
  • Convert the Marten scheduling agent code to IDurabilityAgentStorage, but make it Npgsql-centric
  • New Jasper.Postgresql project for the postgres focused durability code
  • Move NpgsqlConnection/Transaction extension methods to the new Jasper.Postgresql lib
  • Delete [Obsolete] classes
  • Move the "New" classes into the normal namespace
  • Rename IEnvelopePersister to IEnvelopePersistence
  • Make SqlServerSettings & PostgresqlSettings be more consistent
  • Marten version of IEnvelopePersistence needs to become Npgsql centric and move to Postgresql lib
  • Eliminate IDurableMessagingFactory.ClearAllMessages and use the Admin functionality
  • Eliminate IDurableMessagingFactory completely. Use IEnvelopePersistence all the way around
  • Scour Marten session extensions to use new table names
  • Delete the IFeatureSchema from the Marten support
  • All Integration tests pass
  • All Storyteller specs pass. gonna be an ouchie
  • Have the Marten StoreOptions feed the PostgresqlSettings through an IoC lambda registration
  • Introduce a CreateCommand method right off the storage class to simplify the Sql Server agent code
@jeremydmiller

This comment has been minimized.

Copy link
Contributor Author

jeremydmiller commented Mar 5, 2019

I'm breaking out the work for Deferred, new Scheduled table, and EnvelopeType enum to make this work smaller

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.