yreynhout / AggregateSource

Lightweight infrastructure for doing eventsourcing using aggregates
BSD 3-Clause "New" or "Revised" License
257 stars 60 forks source link

No Sagas? #27

Closed thomaseyde closed 5 years ago

thomaseyde commented 6 years ago

How do you implement a saga with AggregateSource? I would like something like Jonathan Oliver's implementation:

public interface ISaga
{
    Guid Id { get; }
    long Version { get; } // for optimistic concurrency

    void Transition(object message);

    ICollection GetUncommittedEvents();
    void ClearUncommittedEvents();

    ICollection GetUndispatchedMessages();
    void ClearUndispatchedMessages();
}
yreynhout commented 6 years ago

@thomaseyde you don't - this is not something AS was designed for. Granted, on the surface it may look very similar.

thomaseyde commented 6 years ago

Fair enough. Are there any recepies? Are we supposed to write our own implementation? Maybe someone should build a "SagaSource" spinoff?

yreynhout commented 6 years ago

You could implement a custom saga using the EventRouter and EventRecorder classes. That'd be a very quick way of going about it.