JasperFx / wolverine

Supercharged .NET server side development!
https://wolverinefx.net
MIT License
1.25k stars 137 forks source link

Support Marten's "Separate Store" Functionality (finally) #929

Closed jeremydmiller closed 5 months ago

jeremydmiller commented 5 months ago

See https://jeremydmiller.com/2024/04/15/modular-monoliths-and-the-critter-stack/ for a little background.

The Marten transactional boundary and/or aggregate handler workflow does not work today with Marten separate stores, and that's been a longstanding limitation.

The goal of this feature work would be to enable Wolverine handlers to target Marten separate stores.

Usage

On the handler class or on an individual Handle() method, decorate with [MartenStore(typeof(ICustomStore))]. We could talk about using conventions for things like "these handlers are in this Marten store", but that makes me nervous. That's the kind of magic that burns teams and following developers.

So:

[MartenStore(typeof(ICustomStore))] // you'd be able to sub class this, and the generic attributes would help later
public static class SomeHandler
{
    public static void Handle(SomeMessage message)
    {

    }
}

Maybe add the store type to [AggretateHandler] as well just to shorten things up

Tasks

jeremydmiller commented 5 months ago

Notes on Implementation