Beispiel #1
0
 public EvenMaster(EvenStartInfo startInfo)
 {
     Self.Tell(startInfo);
     InitializingServices();
 }
Beispiel #2
0
        void InitializeServices(EvenStartInfo startInfo)
        {
            var serializer = startInfo.Serializer;
            var store = startInfo.Store;
            var options = startInfo.Options;
            var registry = new EventRegistry();
            var eventFactory = new PersistedEventFactory(registry, serializer);

            foreach (var kvp in startInfo.EventTypes)
                registry.Register(kvp.Key, kvp.Value);

            // initialize reader
            var readerProps = EventStoreReader.CreateProps(store, eventFactory, options);
            _reader = Context.ActorOf(readerProps, "reader");

            // initialize dispatcher
            var dispatcherProps = EventDispatcher.CreateProps(_reader, options);
            _dispatcher = Context.ActorOf(dispatcherProps, "dispatcher");

            // initialize writer
            var writerProps = EventStoreWriter.CreateProps(store, serializer, _dispatcher, options);
            _writer = Context.ActorOf(writerProps, "writer");

            // initialize event processor supervisor
            var eventProcessorsProps = EventProcessorSupervisor.CreateProps(options);
            _eventProcessors = Context.ActorOf(eventProcessorsProps, "eventprocessors");

            // initialize projection streams supervisor
            var projectionStreamsProps = ProjectionStreamSupervisor.CreateProps(_reader, _writer, options);
            _projectionStreams = Context.ActorOf(projectionStreamsProps, "projectionstreams");

            // initialize projections supervisor
            var projectionProps = ProjectionSupervisor.CreateProps(_projectionStreams, options);
            _projections = Context.ActorOf(projectionProps, "projections");

            // initialize command processors supervisor
            var commandProcessorsProps = CommandProcessorSupervisor.CreateProps(_writer, options);
            _commandProcessors = Context.ActorOf(commandProcessorsProps, "commandprocessors");

            // initialize aggregates
            var aggregatesProps = AggregateSupervisor.CreateProps(_reader, _writer, options);
            _aggregates = Context.ActorOf(aggregatesProps, "aggregates");
        }
Beispiel #3
0
        public static Props CreateProps(EvenStartInfo startInfo)
        {
            Argument.RequiresNotNull(startInfo, nameof(startInfo));

            return Props.Create<EvenMaster>(startInfo);
        }