public async Task Start() { if (queueAdapter.Direction.Equals(StreamProviderDirection.ReadOnly) || queueAdapter.Direction.Equals(StreamProviderDirection.ReadWrite)) { var siloRuntime = providerRuntime as ISiloSideStreamProviderRuntime; if (siloRuntime != null) { pullingAgentManager = await siloRuntime.InitializePullingAgents(Name, adapterFactory, queueAdapter, myConfig); // TODO: No support yet for DeliveryDisabled, only Stopped and Started if (startupState == PersistentStreamProviderState.AgentsStarted) { await pullingAgentManager.StartAgents(); } } } }
public Task InitializePullingAgents( string streamProviderName, StreamQueueBalancerType balancerType, StreamPubSubType pubSubType, IQueueAdapterFactory adapterFactory, IQueueAdapter queueAdapter, TimeSpan getQueueMsgsTimerPeriod, TimeSpan initQueueTimeout, TimeSpan maxEventDeliveryTime) { IStreamQueueBalancer queueBalancer = StreamQueueBalancerFactory.Create( balancerType, streamProviderName, Silo.CurrentSilo.LocalSiloStatusOracle, Silo.CurrentSilo.OrleansConfig, this, adapterFactory.GetStreamQueueMapper()); var managerId = GrainId.NewSystemTargetGrainIdByTypeCode(Constants.PULLING_AGENTS_MANAGER_SYSTEM_TARGET_TYPE_CODE); var manager = new PersistentStreamPullingManager(managerId, streamProviderName, this, this.PubSub(pubSubType), adapterFactory, queueBalancer, getQueueMsgsTimerPeriod, initQueueTimeout, maxEventDeliveryTime); this.RegisterSystemTarget(manager); // Init the manager only after it was registered locally. pullingAgentManager = manager.AsReference <IPersistentStreamPullingManager>(); // Need to call it as a grain reference though. return(pullingAgentManager.Initialize(queueAdapter.AsImmutable())); }
private async Task Start(CancellationToken token) { if (!this.stateManager.PresetState(ProviderState.Started)) { return; } if (this.queueAdapter.Direction.Equals(StreamProviderDirection.ReadOnly) || this.queueAdapter.Direction.Equals(StreamProviderDirection.ReadWrite)) { var siloRuntime = this.runtime as ISiloSideStreamProviderRuntime; if (siloRuntime != null) { this.pullingAgentManager = await siloRuntime.InitializePullingAgents(this.Name, this.adapterFactory, this.queueAdapter); // TODO: No support yet for DeliveryDisabled, only Stopped and Started if (this.lifeCycleOptions.StartupState == StreamLifecycleOptions.RunState.AgentsStarted) { await pullingAgentManager.StartAgents(); } } } stateManager.CommitState(); }