public void setup() { _bus = new InMemoryBus("bus"); _listEventsHandler = new TestHandler <ClientMessage.ReadStreamEventsBackward>(); _bus.Subscribe(_listEventsHandler); _readDispatcher = new RequestResponseDispatcher <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)); _writeDispatcher = new RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (_bus, v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>()); _bus.Subscribe(_readDispatcher); _bus.Subscribe(_writeDispatcher); IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler(); _projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false); _coreProjection = CoreProjection.CreateAndPrepare( "projection", new ProjectionVersion(1, 0, 0), Guid.NewGuid(), _bus, projectionStateHandler, _projectionConfig, _readDispatcher, _writeDispatcher, _subscriptionDispatcher, null, new RealTimeProvider()); _coreProjection.Start(); }
public void setup() { _bus = new InMemoryBus("bus"); _listEventsHandler = new TestHandler<ClientMessage.ReadStreamEventsBackward>(); _bus.Subscribe(_listEventsHandler); _readDispatcher = new RequestResponseDispatcher <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)); _writeDispatcher = new RequestResponseDispatcher<ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>( _bus, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_bus)); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (_bus, v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>()); _bus.Subscribe(_readDispatcher); _bus.Subscribe(_writeDispatcher); IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler(); _projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false); _coreProjection = CoreProjection.CreateAndPrepare( "projection", new ProjectionVersion(1, 0, 0), Guid.NewGuid(), _bus, projectionStateHandler, _projectionConfig, _readDispatcher, _writeDispatcher, _subscriptionDispatcher, null, new RealTimeProvider()); _coreProjection.Start(); }
public FeedReaderService( PublishSubscribeDispatcher <Guid, ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> subscriptionDispatcher, ITimeProvider timeProvider) { _subscriptionDispatcher = subscriptionDispatcher; _timeProvider = timeProvider; }
public void SetUp() { _bus = new InMemoryBus("test"); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage>(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _testQueryDefinition = new QuerySourcesDefinition {AllStreams = true, AllEvents = true}; }
public static FeedReader Create( PublishSubscribeDispatcher <Guid, ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessageBase> publishSubscribeDispatcher, FeedReaderMessage.ReadPage message, ITimeProvider timeProvider) { return(new FeedReader( publishSubscribeDispatcher, message.User, message.QuerySource, message.FromPosition, message.MaxEvents, message.CorrelationId, message.Envelope, timeProvider)); }
public void SetUp() { _bus = new InMemoryBus("test"); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage>(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _testQueryDefinition = new QuerySourcesDefinition { AllStreams = true, AllEvents = true }; }
public void SetUp() { _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (_bus, v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>()); }
public void SetUp() { _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (_bus, v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>()); }
public void SetUp() { _bus = new InMemoryBus("test"); _consumer = new TestHandler <Message>(); _bus.Subscribe(_consumer); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage>(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _testQueryDefinition = GivenQuerySource(); _feedReader = new FeedReader( _subscriptionDispatcher, SystemAccount.Principal, _testQueryDefinition, GivenFromPosition(), 10, Guid.NewGuid(), new PublishEnvelope(_bus), new RealTimeProvider()); Given(); When(); }
public void Setup() { _readDispatcher = new RequestResponseDispatcher <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>( new FakePublisher(), v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(new FakePublisher())); _writeDispatcher = new RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>( new FakePublisher(), v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(new FakePublisher())); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (new FakePublisher(), v => v.SubscriptionId, v => v.SubscriptionId); }
public void Setup() { SetUpManualQueue(); _bus.Subscribe(_consumer); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService( GetInputQueue(), 10, writerCheckpoint, runHeadingReader: GivenHeadingReaderRunning()); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(GetInputQueue(), v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>()); _bus.Subscribe <ReaderCoreServiceMessage.StartReader>(_readerService); _bus.Subscribe <ReaderCoreServiceMessage.StopReader>(_readerService); _bus.Subscribe <ReaderCoreServiceMessage.ReaderTick>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.CommittedEventDistributed>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderEof>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderNotAuthorized>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderIdle>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Pause>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Resume>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Subscribe>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Unsubscribe>(_readerService); GivenAdditionalServices(); _bus.Publish(new ReaderCoreServiceMessage.StartReader()); WhenLoop(); }
public void Setup() { SetUpManualQueue(); _bus.Subscribe(_consumer); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService( GetInputQueue(), 10, writerCheckpoint, runHeadingReader: GivenHeadingReaderRunning()); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(GetInputQueue(), v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe( _subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>()); _bus.Subscribe<ReaderCoreServiceMessage.StartReader>(_readerService); _bus.Subscribe<ReaderCoreServiceMessage.StopReader>(_readerService); _bus.Subscribe<ReaderCoreServiceMessage.ReaderTick>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.CommittedEventDistributed>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderEof>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderNotAuthorized>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderIdle>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Pause>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Resume>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Subscribe>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Unsubscribe>(_readerService); GivenAdditionalServices(); _bus.Publish(new ReaderCoreServiceMessage.StartReader()); WhenLoop(); }
public void Setup() { _readDispatcher = new RequestResponseDispatcher <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>( new FakePublisher(), v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(new FakePublisher())); _writeDispatcher = new RequestResponseDispatcher<ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>( new FakePublisher(), v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(new FakePublisher())); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage> (new FakePublisher(), v => v.SubscriptionId, v => v.SubscriptionId); }
public ProjectionCoreService( IPublisher inputQueue, IPublisher publisher, PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage > subscriptionDispatcher, ITimeProvider timeProvider) { _inputQueue = inputQueue; _publisher = publisher; _readDispatcher = new RequestResponseDispatcher <ClientMessage.ReadStreamEventsBackward, ClientMessage.ReadStreamEventsBackwardCompleted>( publisher, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(inputQueue)); _writeDispatcher = new RequestResponseDispatcher <ClientMessage.WriteEvents, ClientMessage.WriteEventsCompleted>( _publisher, v => v.CorrelationId, v => v.CorrelationId, new PublishEnvelope(_inputQueue)); _subscriptionDispatcher = subscriptionDispatcher; _timeProvider = timeProvider; }
public void Setup() { _consumer = new TestHandler <Message>(); _bus = new InMemoryBus("temp"); _bus.Subscribe(_consumer); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService(_bus, 10, writerCheckpoint, runHeadingReader: true); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _service = new ProjectionCoreService(_bus, _bus, _subscriptionDispatcher, new RealTimeProvider()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>()); _readerService.Handle(new Messages.ReaderCoreServiceMessage.StartReader()); _service.Handle(new ProjectionCoreServiceMessage.StartCore()); }
public ProjectionWorkerNode(TFChunkDb db, QueuedHandler inputQueue, ITimeProvider timeProvider, RunProjections runProjections) { _runProjections = runProjections; Ensure.NotNull(db, "db"); _coreOutput = new InMemoryBus("Core Output"); IPublisher publisher = CoreOutput; _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(publisher, v => v.SubscriptionId, v => v.SubscriptionId); ; _eventReaderCoreService = new EventReaderCoreService( publisher, 10, db.Config.WriterCheckpoint, runHeadingReader: runProjections >= RunProjections.System); _feedReaderService = new FeedReaderService(_subscriptionDispatcher, timeProvider); if (runProjections >= RunProjections.System) { _projectionCoreService = new ProjectionCoreService(inputQueue, publisher, _subscriptionDispatcher, timeProvider); } }
public FeedReader( PublishSubscribeDispatcher <Guid, ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessageBase > subscriptionDispatcher, IPrincipal user, QuerySourcesDefinition querySource, CheckpointTag fromPosition, int maxEvents, Guid requestCorrelationId, IEnvelope replyEnvelope, ITimeProvider timeProvider) { if (subscriptionDispatcher == null) { throw new ArgumentNullException("subscriptionDispatcher"); } if (querySource == null) { throw new ArgumentNullException("querySource"); } if (fromPosition == null) { throw new ArgumentNullException("fromPosition"); } if (replyEnvelope == null) { throw new ArgumentNullException("replyEnvelope"); } if (maxEvents <= 0) { throw new ArgumentException("non-negative expected", "maxEvents"); } _subscriptionDispatcher = subscriptionDispatcher; _user = user; _querySource = querySource; _fromPosition = fromPosition; _maxEvents = maxEvents; _requestCorrelationId = requestCorrelationId; _replyEnvelope = replyEnvelope; _timeProvider = timeProvider; }
public void SetUp() { _bus = new InMemoryBus("test"); _consumer = new TestHandler<Message>(); _bus.Subscribe(_consumer); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage>(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _testQueryDefinition = GivenQuerySource(); _feedReader = new FeedReader( _subscriptionDispatcher, SystemAccount.Principal, _testQueryDefinition, GivenFromPosition(), 10, Guid.NewGuid(), new PublishEnvelope(_bus), new RealTimeProvider()); Given(); When(); }
public void Setup() { SetUpManualQueue(); //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well _bus.Subscribe(_consumer); _manager = new ProjectionManager( GetInputQueue(), GetInputQueue(), new[] {GetInputQueue()}, _timeProvider, RunProjections.All, _initializeSystemProjections); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService(GetInputQueue(), 10, writerCheckpoint, runHeadingReader: true); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(GetInputQueue(), v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>()); _coreService = new ProjectionCoreService(GetInputQueue(), GetInputQueue(), _subscriptionDispatcher, _timeProvider); _bus.Subscribe<ProjectionManagementMessage.Internal.CleanupExpired>(_manager); _bus.Subscribe<ProjectionManagementMessage.Internal.Deleted>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.Started>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.Stopped>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.Prepared>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.Faulted>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.StateReport>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.ResultReport>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.StatisticsReport>(_manager); _bus.Subscribe<ProjectionManagementMessage.Post>(_manager); _bus.Subscribe<ProjectionManagementMessage.UpdateQuery>(_manager); _bus.Subscribe<ProjectionManagementMessage.GetQuery>(_manager); _bus.Subscribe<ProjectionManagementMessage.Delete>(_manager); _bus.Subscribe<ProjectionManagementMessage.GetStatistics>(_manager); _bus.Subscribe<ProjectionManagementMessage.GetState>(_manager); _bus.Subscribe<ProjectionManagementMessage.GetResult>(_manager); _bus.Subscribe<ProjectionManagementMessage.Disable>(_manager); _bus.Subscribe<ProjectionManagementMessage.Enable>(_manager); _bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager); _bus.Subscribe<ProjectionManagementMessage.Reset>(_manager); _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager); _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager); _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager); _bus.Subscribe<SystemMessage.StateChangeMessage>(_manager); _bus.Subscribe<CoreProjectionManagementMessage.CreateAndPrepare>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.CreatePrepared>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.Dispose>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.Start>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.LoadStopped>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.Stop>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.Kill>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.GetState>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.GetResult>(_coreService); _bus.Subscribe<CoreProjectionManagementMessage.UpdateStatistics>(_coreService); _bus.Subscribe<CoreProjectionProcessingMessage.CheckpointCompleted>(_coreService); _bus.Subscribe<CoreProjectionProcessingMessage.CheckpointLoaded>(_coreService); _bus.Subscribe<CoreProjectionProcessingMessage.PrerecordedEventsLoaded>(_coreService); _bus.Subscribe<CoreProjectionProcessingMessage.RestartRequested>(_coreService); _bus.Subscribe<CoreProjectionProcessingMessage.Failed>(_coreService); _bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService); _bus.Subscribe<ClientMessage.WriteEventsCompleted>(_coreService); _bus.Subscribe<ProjectionCoreServiceMessage.StartCore>(_coreService); _bus.Subscribe<ProjectionCoreServiceMessage.StopCore>(_coreService); _bus.Subscribe<ReaderCoreServiceMessage.StartReader>(_readerService); _bus.Subscribe<ReaderCoreServiceMessage.StopReader>(_readerService); _bus.Subscribe<ProjectionCoreServiceMessage.CoreTick>(_coreService); _bus.Subscribe<ReaderCoreServiceMessage.ReaderTick>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.CommittedEventDistributed>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderEof>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderNotAuthorized>(_readerService); _bus.Subscribe<ReaderSubscriptionMessage.EventReaderIdle>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Pause>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Resume>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Subscribe>(_readerService); _bus.Subscribe<ReaderSubscriptionManagement.Unsubscribe>(_readerService); Given(); WhenLoop(); }
public void Setup() { SetUpManualQueue(); //TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well _bus.Subscribe(_consumer); _manager = new ProjectionManager( GetInputQueue(), GetInputQueue(), new[] { GetInputQueue() }, _timeProvider, RunProjections.All, _initializeSystemProjections); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService(GetInputQueue(), 10, writerCheckpoint, runHeadingReader: true); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(GetInputQueue(), v => v.SubscriptionId, v => v.SubscriptionId); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber <EventReaderSubscriptionMessage.NotAuthorized>()); _coreService = new ProjectionCoreService(GetInputQueue(), GetInputQueue(), _subscriptionDispatcher, _timeProvider); _bus.Subscribe <ProjectionManagementMessage.Internal.CleanupExpired>(_manager); _bus.Subscribe <ProjectionManagementMessage.Internal.Deleted>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.Started>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.Stopped>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.Prepared>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.Faulted>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.StateReport>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.ResultReport>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.StatisticsReport>(_manager); _bus.Subscribe <ProjectionManagementMessage.Post>(_manager); _bus.Subscribe <ProjectionManagementMessage.UpdateQuery>(_manager); _bus.Subscribe <ProjectionManagementMessage.GetQuery>(_manager); _bus.Subscribe <ProjectionManagementMessage.Delete>(_manager); _bus.Subscribe <ProjectionManagementMessage.GetStatistics>(_manager); _bus.Subscribe <ProjectionManagementMessage.GetState>(_manager); _bus.Subscribe <ProjectionManagementMessage.GetResult>(_manager); _bus.Subscribe <ProjectionManagementMessage.Disable>(_manager); _bus.Subscribe <ProjectionManagementMessage.Enable>(_manager); _bus.Subscribe <ProjectionManagementMessage.SetRunAs>(_manager); _bus.Subscribe <ProjectionManagementMessage.Reset>(_manager); _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager); _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_manager); _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_manager); _bus.Subscribe <SystemMessage.StateChangeMessage>(_manager); _bus.Subscribe <CoreProjectionManagementMessage.CreateAndPrepare>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.CreatePrepared>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.Dispose>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.Start>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.LoadStopped>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.Stop>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.Kill>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.GetState>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.GetResult>(_coreService); _bus.Subscribe <CoreProjectionManagementMessage.UpdateStatistics>(_coreService); _bus.Subscribe <CoreProjectionProcessingMessage.CheckpointCompleted>(_coreService); _bus.Subscribe <CoreProjectionProcessingMessage.CheckpointLoaded>(_coreService); _bus.Subscribe <CoreProjectionProcessingMessage.PrerecordedEventsLoaded>(_coreService); _bus.Subscribe <CoreProjectionProcessingMessage.RestartRequested>(_coreService); _bus.Subscribe <CoreProjectionProcessingMessage.Failed>(_coreService); _bus.Subscribe <ClientMessage.ReadStreamEventsBackwardCompleted>(_coreService); _bus.Subscribe <ClientMessage.WriteEventsCompleted>(_coreService); _bus.Subscribe <ProjectionCoreServiceMessage.StartCore>(_coreService); _bus.Subscribe <ProjectionCoreServiceMessage.StopCore>(_coreService); _bus.Subscribe <ReaderCoreServiceMessage.StartReader>(_readerService); _bus.Subscribe <ReaderCoreServiceMessage.StopReader>(_readerService); _bus.Subscribe <ProjectionCoreServiceMessage.CoreTick>(_coreService); _bus.Subscribe <ReaderCoreServiceMessage.ReaderTick>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.CommittedEventDistributed>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderEof>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderNotAuthorized>(_readerService); _bus.Subscribe <ReaderSubscriptionMessage.EventReaderIdle>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Pause>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Resume>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Subscribe>(_readerService); _bus.Subscribe <ReaderSubscriptionManagement.Unsubscribe>(_readerService); Given(); WhenLoop(); }
public void Setup() { _consumer = new TestHandler<Message>(); _bus = new InMemoryBus("temp"); _bus.Subscribe(_consumer); ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000); _readerService = new EventReaderCoreService(_bus, 10, writerCheckpoint, runHeadingReader: true); _subscriptionDispatcher = new PublishSubscribeDispatcher <ReaderSubscriptionManagement.Subscribe, ReaderSubscriptionManagement.ReaderSubscriptionManagementMessage, EventReaderSubscriptionMessage >(_bus, v => v.SubscriptionId, v => v.SubscriptionId); _service = new ProjectionCoreService(_bus, _bus, _subscriptionDispatcher, new RealTimeProvider()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>()); _bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>()); _readerService.Handle(new Messages.ReaderCoreServiceMessage.StartReader()); _service.Handle(new ProjectionCoreServiceMessage.StartCore()); }