public IndexedProjectionStreamReader(IEventStoreReader reader, PersistedEventFactory factory)
        {
            Argument.Requires(reader != null, nameof(reader));
            Argument.Requires(factory != null, nameof(factory));

            _workerProps = Props.Create<ReadIndexedProjectionStreamWorker>(reader, factory);
            Receive<ReadIndexedProjectionStreamRequest>(r => HandleRequest(r));
        }
Example #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");
        }