-
-
Notifications
You must be signed in to change notification settings - Fork 142
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
Enhanced "Aggregate Handler Workflow" #935
Comments
Notes
[AggregateHandler(typeof(SomeAggregate))]
public static class SomeAggregateHandler
{
// To start the aggregate. Would be able to follow the same rules for message signatures
public static 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????
public static IEnumerable<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 well
public static IEnumerable<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 response
public static (Sidekick, SidekickRenamed) HandleAsync(
Guid sidekickId,
string name,
[Aggregate("sidekickId")] Sidekick sidekick
)
{
var renamed = new SidekickRenamed(sidekickId, name);
return (sidekick, renamed);
} |
This was referenced Jan 10, 2025
This might now include a slightly easier to use version of a start stream return type: public class StartStream : List<object>, ISideEffectAware, IMartenOp
{
public StartStream()
{
StreamId = global::Marten.Schema.Identity.CombGuidIdGeneration.NewGuid();
StreamKey = StreamId.ToString();
}
public static Frame BuildFrame(IChain chain, Variable variable, GenerationRules rules, IServiceContainer container)
{
throw new NotImplementedException();
}
void IMartenOp.Execute(IDocumentSession session)
{
// nothing, just need it for the interface
}
public string StreamKey { get; }
public Guid StreamId { get; }
public Type AggregateType { get; set; }
} Notes
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: