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.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using it with a client, and I've seen a couple wrinkles to iron out. This will require a little bit of work on the Marten side too.
Sometimes, even frequently, the Aggregate isn't necessary for the "decider" function. So in this case, don't even build out the aggregate. Still enforce all the same concurrency checks, but don't bother for building out the aggregate
Make damn sure you don't have to use the Aggregate at all on "create" handler methods that return an IMartenOp. Thought this was done, but still
Go ahead and do the optimizations at the Marten level such that an Inline aggregate is never fetched more than once. Opt into the identity map for just that aggregate type on the session
Use a special signature for message handlers to start it? Works on message handlers, but maybe not so much for HTTP endpoints. Something like Start(command) that returns the events? Does an StartStream using the aggregate type.
For HTTP endpoints, think about this
[AggregateHandler(typeof(SomeAggregate))]publicstaticclassSomeAggregateHandler{// To start the aggregate. Would be able to follow the same rules for message signatures publicstatic Events Start(command){// Naming convention does a new stream}// Enable Wolverine to use the workflow w/o having to first build the aggregate. // There's not *always* a need to do the validation// Might require a Marten FetchForWriting() that doesn't do the aggregation????publicstaticIEnumerable<object>Handle(command){}// IF the aggregate is updated through an Inline projection, make sure you don't// double fetch so that the aggregate is used for the projection as wellpublicstaticIEnumerable<object>Handle(command,aggregate){}}
And in HTTP endpoint world:
// TODO -- figure out a better way to do starting a stream?// MAYBE use a custom IResult for writing the aggregate from a Start???[Transactional][WolverinePost("/sidekicks/{sidekickId}/rename/{name}")]// If Inline, update the Sidekick object built up originally// If live, update the Sidekick object with new events before writing to HTTP responsepublicstatic(Sidekick, SidekickRenamed)HandleAsync(GuidsidekickId,stringname,[Aggregate("sidekickId")]Sidekicksidekick){varrenamed=new SidekickRenamed(sidekickId, name);return(sidekick, renamed);}
Using it with a client, and I've seen a couple wrinkles to iron out. This will require a little bit of work on the Marten side too.
cc @gergelyurbancsik
The text was updated successfully, but these errors were encountered: