コード例 #1
0
ファイル: Program.cs プロジェクト: daniel-buchanan/project-k
        private static void RegisterEventListeners(IEventStream stream)
        {
            var observationMutator = new ObservationMutator();
            var observationStore   = new AggregateStore <Observation>(Observations);
            var arrived            = new AnimalArrivedEventProcessor(observationMutator, observationStore);

            stream.RegisterListener(arrived);

            var animalMutator = new AnimalMutator();
            var animalStore   = new AggregateStore <Animal>(Animals);
            var created       = new AnimalCreatedEventProcessor(animalMutator, animalStore);

            stream.RegisterListener(created);

            var mobMutator = new MobMutator();
            var mobStore   = new AggregateStore <Mob>(Mobs);
            var mobCreated = new MobCreatedEventProcessor(mobMutator, mobStore);

            stream.RegisterListener(mobCreated);

            var animalHistory = new AnimalIntoMobExtrapolator(stream, MobHistories);
            var intoMob       = new AnimalIntoMobEventProcessor(animalHistory);

            stream.RegisterListener(intoMob);

            var animalUpdated = new AnimalUpdatedEventProcessor(animalMutator, animalStore);

            stream.RegisterListener(animalUpdated);
        }