Giter VIP home page Giter VIP logo

aggregatesource's Introduction

AggregateSource

Gitter

This library/code provides lightweight infrastructure for doing eventsourcing using aggregates. It's not a framework, and it never will be. Period.

The preferred way of using it, is copying it into your project and getting rid of all the cruft you don't need. That said, there are NuGet packages available for those of you that are pressed for time and don't mind following the prescribed recipe.

It's well suited for those scenarios where multiple aggregates need to collaborate and is lenient to saving multiple aggregates in one go should your underlying store allow you to do so or your problem domain require you to do so. Of course, nothing is holding you back from throwing when multiple aggregates have been changed. I just think this shouldn't interfere with the programming model you use. Granted, for affecting only one aggregate, there are simpler solutions and to be honest, what I bring you here is in no way unique:

Core

Contains the core types that you will want interact with when building your domain model. A more thorough explanation can be found here

Testing

Helps you write test specifications, using a simple, codified statechart and a fluent syntax. A more thorough explanation can be found here

License

Licensed using a BSD 3-Clause License. See License.txt for more details

Discussion

Have questions? Head on over to the discussion group: https://groups.google.com/forum/#!forum/aggregatesource

Build

RunRightOffThe.bat provides a sanity check. It's a combination of RunMeFirst.bat and RunBuild.bat. Before working with the solution it's probably best to run the RunMeFirst.bat, well, first. It restores NuGet packages and downloads and unzips a version of GetEventStore. RunBuild.bat and RunTest.bat should speak for themselves.

Continuous integration

The build is generously hosted and run on the CodeBetter TeamCity infrastructure, courtesy of JetBrains. In the future, NDepend will be used to analyze the assemblies.

Status of last build
master master

YouTrack and TeamCity

NDepend

Contributors

  • Yves Reynhout (@yreynhout): Maintainer
  • Martijn Van den Broek (@martijnvdbrk): Optional<T> as a struct
  • James Nugent (@jen20): ConstructorScenarioFor<TAggregateRoot>, GetEventStore integration

aggregatesource's People

Contributors

gitter-badger avatar martijnvdbrk avatar tunurgitr avatar yreynhout avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

aggregatesource's Issues

No Sagas?

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();
}

[DESIGN] Enable support for Up/Down casting of events

Meet a new citizen

    public interface IEventConverter<in TEvent> 
    {
        IEnumerable<object> Convert(TEvent @event);
    }

Requires that the IEventDeserializer relaxes a bit as well

    public interface IEventDeserializer
    {
        IEnumerable<object> Deserialize(ResolvedEvent resolvedEvent);
    }

Extracting/Separate ES Repo Lib?

I'm planning to use F# intrinsics to pretty much all testing/impl of Aggregates a la FsUno.

Within the sample are switchable GES/InMemory 'Store' impl consisting of two [F#] functions:-

  • readEvents
  • appendEvents

All that's missing from my perspective is a third implementation of those functions :- for NEventStore

I'll probably go to production against NES but obviously the ideal is to either have it switchable to GES when the time is right or at least not have cornered myself abusing NESisms that are going to be fundamentally incompatible.

While the merit of the LCD between them is obviously debatable, it nonetheless is something I am interesting in sweeping to the side for a time.

I'm wondering whether you have future plans/ideas/opinions re extracting an ES repo abstraction as a separate thing ?

I'm not talkiing about starting some superproject that will unify all Event Sourcing impls planet-wide; more like an OWIN-like 'spec' consisting of 2 function sigs with drop-in impls which would be adhere to that common 'interface'

Snapshotting

I'm dissecting the code base and I'm assuming the snapshots are sorta following the memento pattern but I can't actually work out from the tests how within this code base its supposed to work.

I can see it follows similar implementations to others Ive seen (ISnapshotable on aggregate / methods to pull and push data to set state)

public void RestoreSnapshot(object state)
    {
      var agg = (MyAggregateSnapshotPoco)state;
      /* mapping data back to agg */
    }

    public object TakeSnapshot()
    {
      return MyAggregateSnapshotPoco{map agg in};
    }

I can't see any logic around storing the memento if version is greater than zero and mod 10 (or similar);
Is there a reason for SnapshotableRepository being a different thing to the repository storing snapshots? I'm guessing the SnapshotableRepository storage as stream should result in a different ident (snapshot_id or something) to avoid conflicting with the aggregate stream but its not enforced (the tests dont clear this up as the names it uses follow the same prefix).

I was wondering if I was misunderstanding the usage as it seems you'd need both and the methods between the two are similar due to the interface but it makes usage less obvious.

Any explanation would be greatly appreciated; I'm looking at various implementations alongside our existing and trying to understand the thought process behind it ๐Ÿ˜„

NUnit Assertions

Add a project with NUnit Assertion Extensions, so people can bootstrap from there. Lowering the barrier to entry so to speak.

[DESIGN] Testing closer to the aggregate surface for factories, queries and commands

  //Factory
  new FactoryScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId)).
    When(root => root.CreateSubPortfolio(subPortfolioId)).
    AssertThat(new SubPortfolioCreated(subPortfolioId, portfolioId));

  new FactoryScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId), new PortfolioArchived(portfolioId)).
    When(root => root.CreateSubPortfolio(subPortfolioId)).
    AssertThrows(new PortfolioArchivedException());

  //Query
  new QueryScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId)).
    When(root => root.IsArchived).
    AssertThatResultIs(false);

  new QueryScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId), new PortfolioArchived(portfolioId)).
    When(root => root.DueDate).
    AssertThrows(new PortfolioArchivedException());

  //Command
  new CommandScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId)).
    When(root => root.Archive()).
    AssertThat(new PortfolioArchived(portfolioId));

  new CommandScenarioFor<Portfolio>(new Portfolio()).
    Given(new PortfolioCreated(portfolioId), new PortfolioArchived(portfolioId)).
    When(root => root.Archive()).
    AssertThrows(new PortfolioArchivedException());

StreamSource Nancy Module

Build a set of resources, explore collection api, explore atomfeed, expose them using a NancyModule. The resources revolve around events, streams, causations, correlations, etc ...

Thread static UnitOfWork is a mistake

Man, don't do it :)
http://michaelfeathers.typepad.com/michael_feathers_blog/2012/12/global-variables-destroy-design-information.html

Better leave it as per-request object. You create it, you pass it to handlers, and then you commit it. That's it.

Oh, and you don't need Repository. Just having UoW is enough. Communicate with ES from it.

Sorry, I hate that Github still hasn't figured out a way to attach discussions to source files instead of only being able to comment on commits :(

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.