本文整理汇总了C#中IODispatcher类的典型用法代码示例。如果您正苦于以下问题:C# IODispatcher类的具体用法?C# IODispatcher怎么用?C# IODispatcher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IODispatcher类属于命名空间,在下文中一共展示了IODispatcher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: setup
public void setup()
{
_bus = new InMemoryBus("bus");
_listEventsHandler = new TestHandler<ClientMessage.ReadStreamEventsBackward>();
_bus.Subscribe(_listEventsHandler);
_ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(_bus));
_subscriptionDispatcher =
new ReaderSubscriptionDispatcher
(_bus);
_bus.Subscribe(
_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
_bus.Subscribe(
_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionEofReached>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionMeasured>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.SubscriptionStarted>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ReaderAssignedReader>());
_bus.Subscribe(_ioDispatcher.BackwardReader);
_bus.Subscribe(_ioDispatcher.ForwardReader);
_bus.Subscribe(_ioDispatcher.Writer);
_bus.Subscribe(_ioDispatcher);
IProjectionStateHandler projectionStateHandler = new FakeProjectionStateHandler();
_projectionConfig = new ProjectionConfig(null, 5, 10, 1000, 250, true, true, false, false, false);
var version = new ProjectionVersion(1, 0, 0);
var projectionProcessingStrategy = new ContinuousProjectionProcessingStrategy(
"projection", version, projectionStateHandler, _projectionConfig,
projectionStateHandler.GetSourceDefinition(), null, _subscriptionDispatcher);
_coreProjection = projectionProcessingStrategy.Create(
Guid.NewGuid(), _bus, SystemAccount.Principal, _bus, _ioDispatcher, _subscriptionDispatcher,
new RealTimeProvider());
_coreProjection.Start();
}
示例2: CreatePausedEventReader
public IEventReader CreatePausedEventReader(
Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
bool stopOnEof, int? stopAfterNEvents)
{
return new AllStreamsCatalogEventReader(
ioDispatcher, publisher, eventReaderId, _runAs, checkpointTag.CatalogPosition + 1, _timeProvider, stopOnEof: stopOnEof);
}
示例3: CreateProjectionProcessingPhases
protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
IProjectionProcessingPhase firstPhase)
{
var coreProjectionCheckpointWriter =
new CoreProjectionCheckpointWriter(
namingBuilder.MakeCheckpointStreamName(), ioDispatcher, _projectionVersion, _name);
var checkpointManager2 = new DefaultCheckpointManager(
publisher, projectionCorrelationId, _projectionVersion, _projectionConfig.RunAs, ioDispatcher,
_projectionConfig, _name, new PhasePositionTagger(1), namingBuilder, GetUseCheckpoints(), false,
_sourceDefinition.DefinesFold, coreProjectionCheckpointWriter);
IProjectionProcessingPhase writeResultsPhase;
if (GetProducesRunningResults()
|| !string.IsNullOrEmpty(_sourceDefinition.CatalogStream) && _sourceDefinition.ByStreams)
writeResultsPhase = new WriteQueryEofProjectionProcessingPhase(
1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
checkpointManager2);
else
writeResultsPhase = new WriteQueryResultProjectionProcessingPhase(
1, namingBuilder.GetResultStreamName(), coreProjection, partitionStateCache, checkpointManager2,
checkpointManager2);
return new[] {firstPhase, writeResultsPhase};
}
示例4: CreateProcessingPhases
public override sealed IProjectionProcessingPhase[] CreateProcessingPhases(
IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache,
Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder,
ITimeProvider timeProvider, IODispatcher ioDispatcher,
CoreProjectionCheckpointWriter coreProjectionCheckpointWriter)
{
var definesFold = _sourceDefinition.DefinesFold;
var readerStrategy = CreateReaderStrategy(timeProvider);
var zeroCheckpointTag = readerStrategy.PositionTagger.MakeZeroCheckpointTag();
var checkpointManager = CreateCheckpointManager(
projectionCorrelationId, publisher, ioDispatcher, namingBuilder, coreProjectionCheckpointWriter,
definesFold, readerStrategy);
var resultWriter = CreateFirstPhaseResultWriter(
checkpointManager as IEmittedEventWriter, zeroCheckpointTag, namingBuilder);
var firstPhase = CreateFirstProcessingPhase(
publisher, projectionCorrelationId, partitionStateCache, updateStatistics, coreProjection,
_subscriptionDispatcher, zeroCheckpointTag, checkpointManager, readerStrategy, resultWriter);
return CreateProjectionProcessingPhases(
publisher, projectionCorrelationId, namingBuilder, partitionStateCache, coreProjection, ioDispatcher,
firstPhase);
}
示例5: Setup
public void Setup()
{
_consumer = new TestHandler<Message>();
_bus = new InMemoryBus("temp");
_bus.Subscribe(_consumer);
ICheckpoint writerCheckpoint = new InMemoryCheckpoint(1000);
var ioDispatcher = new IODispatcher(_bus, new PublishEnvelope(_bus));
_readerService = new EventReaderCoreService(_bus, ioDispatcher, 10, writerCheckpoint, runHeadingReader: true);
_subscriptionDispatcher =
new ReaderSubscriptionDispatcher(_bus);
_spoolProcessingResponseDispatcher = new SpooledStreamReadingDispatcher(_bus);
_timeoutScheduler = new TimeoutScheduler();
_workerId = Guid.NewGuid();
_service = new ProjectionCoreService(
_workerId, _bus, _bus, _subscriptionDispatcher, new RealTimeProvider(), ioDispatcher,
_spoolProcessingResponseDispatcher, _timeoutScheduler);
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CheckpointSuggested>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.CommittedEventReceived>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.EofReached>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionEofReached>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionMeasured>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.PartitionDeleted>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ProgressChanged>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.SubscriptionStarted>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.NotAuthorized>());
_bus.Subscribe(_subscriptionDispatcher.CreateSubscriber<EventReaderSubscriptionMessage.ReaderAssignedReader>());
_bus.Subscribe(_spoolProcessingResponseDispatcher.CreateSubscriber<PartitionProcessingResult>());
_readerService.Handle(new Messages.ReaderCoreServiceMessage.StartReader());
_service.Handle(new ProjectionCoreServiceMessage.StartCore());
}
示例6: CreateProjectionProcessingPhases
protected override IProjectionProcessingPhase[] CreateProjectionProcessingPhases(
IPublisher publisher, Guid projectionCorrelationId, ProjectionNamesBuilder namingBuilder,
PartitionStateCache partitionStateCache, CoreProjection coreProjection, IODispatcher ioDispatcher,
IProjectionProcessingPhase firstPhase)
{
return new[] {firstPhase};
}
示例7: BuildAuthenticationProvider
public IAuthenticationProvider BuildAuthenticationProvider(IPublisher mainQueue, IBus mainBus, IPublisher workersQueue, InMemoryBus[] workerBusses)
{
var passwordHashAlgorithm = new Rfc2898PasswordHashAlgorithm();
var dispatcher = new IODispatcher(mainQueue, new PublishEnvelope(workersQueue, crossThread: true));
foreach (var bus in workerBusses) {
bus.Subscribe(dispatcher.ForwardReader);
bus.Subscribe(dispatcher.BackwardReader);
bus.Subscribe(dispatcher.Writer);
bus.Subscribe(dispatcher.StreamDeleter);
bus.Subscribe(dispatcher);
}
// USER MANAGEMENT
var ioDispatcher = new IODispatcher(mainQueue, new PublishEnvelope(mainQueue));
mainBus.Subscribe(ioDispatcher.BackwardReader);
mainBus.Subscribe(ioDispatcher.ForwardReader);
mainBus.Subscribe(ioDispatcher.Writer);
mainBus.Subscribe(ioDispatcher.StreamDeleter);
mainBus.Subscribe(ioDispatcher);
var userManagement = new UserManagementService(mainQueue, ioDispatcher, passwordHashAlgorithm, skipInitializeStandardUsersCheck: false);
mainBus.Subscribe<UserManagementMessage.Create>(userManagement);
mainBus.Subscribe<UserManagementMessage.Update>(userManagement);
mainBus.Subscribe<UserManagementMessage.Enable>(userManagement);
mainBus.Subscribe<UserManagementMessage.Disable>(userManagement);
mainBus.Subscribe<UserManagementMessage.Delete>(userManagement);
mainBus.Subscribe<UserManagementMessage.ResetPassword>(userManagement);
mainBus.Subscribe<UserManagementMessage.ChangePassword>(userManagement);
mainBus.Subscribe<UserManagementMessage.Get>(userManagement);
mainBus.Subscribe<UserManagementMessage.GetAll>(userManagement);
mainBus.Subscribe<SystemMessage.BecomeMaster>(userManagement);
return new InternalAuthenticationProvider(dispatcher, passwordHashAlgorithm, ESConsts.CachedPrincipalCount);
}
示例8: TestFixtureSetUp
public override void TestFixtureSetUp()
{
base.TestFixtureSetUp();
WriterCheckpoint = new InMemoryCheckpoint(0);
ChaserCheckpoint = new InMemoryCheckpoint(0);
Bus = new InMemoryBus("bus");
IODispatcher = new IODispatcher(Bus, new PublishEnvelope(Bus));
Db = new TFChunkDb(new TFChunkDbConfig(PathName,
new VersionedPatternFileNamingStrategy(PathName, "chunk-"),
10000,
0,
WriterCheckpoint,
ChaserCheckpoint,
new InMemoryCheckpoint(-1),
new InMemoryCheckpoint(-1)));
Db.Open();
// create db
Writer = new TFChunkWriter(Db);
Writer.Open();
WriteTestScenario();
Writer.Close();
Writer = null;
WriterCheckpoint.Flush();
ChaserCheckpoint.Write(WriterCheckpoint.Read());
ChaserCheckpoint.Flush();
var readers = new ObjectPool<ITransactionFileReader>("Readers", 2, 5, () => new TFChunkReader(Db, Db.Config.WriterCheckpoint));
var lowHasher = new XXHashUnsafe();
var highHasher = new Murmur3AUnsafe();
TableIndex = new TableIndex(GetFilePathFor("index"), lowHasher, highHasher,
() => new HashListMemTable(PTableVersions.Index64Bit, MaxEntriesInMemTable * 2),
() => new TFReaderLease(readers),
PTableVersions.Index64Bit,
MaxEntriesInMemTable);
ReadIndex = new ReadIndex(new NoopPublisher(),
readers,
TableIndex,
0,
additionalCommitChecks: true,
metastreamMaxCount: MetastreamMaxCount,
hashCollisionReadLimit: Opts.HashCollisionReadLimitDefault);
ReadIndex.Init(ChaserCheckpoint.Read());
// scavenge must run after readIndex is built
if (_scavenge)
{
if (_completeLastChunkOnScavenge)
Db.Manager.GetChunk(Db.Manager.ChunksCount - 1).Complete();
_scavenger = new TFChunkScavenger(Db, IODispatcher, TableIndex, ReadIndex, Guid.NewGuid(), "fakeNodeIp");
_scavenger.Scavenge(alwaysKeepScavenged: true, mergeChunks: _mergeChunks);
}
}
示例9: CreatePausedEventReader
public IEventReader CreatePausedEventReader(
Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
bool stopOnEof, int? stopAfterNEvents)
{
return new ExternallyFedByStreamEventReader(
publisher, eventReaderId, SystemAccount.Principal, ioDispatcher, checkpointTag.CommitPosition,
_timeProvider, resolveLinkTos: true);
}
示例10: CreatePausedEventReader
public IEventReader CreatePausedEventReader(
Guid eventReaderId, IPublisher publisher, IODispatcher ioDispatcher, CheckpointTag checkpointTag,
bool stopOnEof, int? stopAfterNEvents)
{
return new StreamEventReader(
publisher, eventReaderId, _runAs, _catalogStream, checkpointTag.CatalogPosition + 1, _timeProvider,
resolveLinkTos: true, stopOnEof: stopOnEof, stopAfterNEvents: stopAfterNEvents);
}
示例11: CreateProcessingPhases
public override IProjectionProcessingPhase[] CreateProcessingPhases(
IPublisher publisher, Guid projectionCorrelationId, PartitionStateCache partitionStateCache,
Action updateStatistics, CoreProjection coreProjection, ProjectionNamesBuilder namingBuilder,
ITimeProvider timeProvider, IODispatcher ioDispatcher,
CoreProjectionCheckpointWriter coreProjectionCheckpointWriter)
{
return new IProjectionProcessingPhase[] {_phase1, _phase2};
}
示例12: CreateCheckpointManager
protected override ICoreProjectionCheckpointManager CreateCheckpointManager(
Guid projectionCorrelationId, IPublisher publisher, IODispatcher ioDispatcher, ProjectionNamesBuilder namingBuilder,
CoreProjectionCheckpointWriter coreProjectionCheckpointWriter, bool definesFold, IReaderStrategy readerStrategy)
{
return new NoopCheckpointManager(
publisher, projectionCorrelationId, _projectionConfig, _name, readerStrategy.PositionTagger,
namingBuilder);
}
示例13: Setup
public void Setup()
{
var fakePublisher = new FakePublisher();
_ioDispatcher = new IODispatcher(fakePublisher, new PublishEnvelope(fakePublisher));
_subscriptionDispatcher =
new ReaderSubscriptionDispatcher(new FakePublisher());
}
示例14: Setup
public void Setup()
{
//TODO: this became an integration test - proper ProjectionCoreService and ProjectionManager testing is required as well
_bus.Subscribe(_consumer);
_manager = new ProjectionManager(
GetInputQueue(), GetInputQueue(), GivenCoreQueues(), _timeProvider, RunProjections.All,
_initializeSystemProjections);
IPublisher inputQueue = GetInputQueue();
IPublisher publisher = GetInputQueue();
var ioDispatcher = new IODispatcher(publisher, new PublishEnvelope(inputQueue));
_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<CoreProjectionManagementMessage.SlaveProjectionReaderAssigned>(_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.Abort>(_manager);
_bus.Subscribe<ProjectionManagementMessage.SetRunAs>(_manager);
_bus.Subscribe<ProjectionManagementMessage.Reset>(_manager);
_bus.Subscribe<ProjectionManagementMessage.StartSlaveProjections>(_manager);
_bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
_bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(_manager);
_bus.Subscribe<ClientMessage.WriteEventsCompleted>(_manager);
_bus.Subscribe<SystemMessage.StateChangeMessage>(_manager);
_bus.Subscribe<ClientMessage.ReadStreamEventsForwardCompleted>(ioDispatcher.ForwardReader);
_bus.Subscribe<ClientMessage.ReadStreamEventsBackwardCompleted>(ioDispatcher.BackwardReader);
_bus.Subscribe<ClientMessage.WriteEventsCompleted>(ioDispatcher.Writer);
_bus.Subscribe<ClientMessage.DeleteStreamCompleted>(ioDispatcher.StreamDeleter);
_bus.Subscribe<IODispatcherDelayedMessage>(ioDispatcher);
_awakeReaderService = new AwakeReaderService();
_bus.Subscribe<StorageMessage.EventCommitted>(_awakeReaderService);
_bus.Subscribe<StorageMessage.TfEofAtNonCommitRecord>(_awakeReaderService);
_bus.Subscribe<AwakeReaderServiceMessage.SubscribeAwake>(_awakeReaderService);
_bus.Subscribe<AwakeReaderServiceMessage.UnsubscribeAwake>(_awakeReaderService);
Given();
WhenLoop();
}
开发者ID:kijanawoodard,项目名称:EventStore,代码行数:57,代码来源:specification_with_projection_management_service.cs
示例15: CoreProjectionCheckpointReader
public CoreProjectionCheckpointReader(
IPublisher publisher, Guid projectionCorrelationId, IODispatcher ioDispatcher, string projectionCheckpointStreamId, ProjectionVersion projectionVersion, bool useCheckpoints)
{
_publisher = publisher;
_projectionCorrelationId = projectionCorrelationId;
_ioDispatcher = ioDispatcher;
_projectionCheckpointStreamId = projectionCheckpointStreamId;
_projectionVersion = projectionVersion;
_useCheckpoints = useCheckpoints;
}