Ejemplo n.º 1
0
 public async Task Start()
 {
     if (providerRuntime.InSilo)
     {
         IStreamQueueBalancer queueBalancer = StreamQueueBalancerFactory.Create(balancerType, Name, providerRuntime, queueAdapter.GetStreamQueueMapper());
         var managerId = GrainId.NewSystemTargetGrainIdByTypeCode(Constants.PULLING_AGENTS_MANAGER_SYSTEM_TARGET_TYPE_CODE);
         var manager   = new PersistentStreamPullingManager(managerId, Name, providerRuntime, queueBalancer, getQueueMsgsTimerPeriod, initQueueTimeout);
         providerRuntime.RegisterSystemTarget(manager);
         // Init the manager only after it was registered locally.
         var managerGrainRef = PersistentStreamPullingManagerFactory.Cast(manager.AsReference());
         // Need to call it as a grain reference though.
         await managerGrainRef.Initialize(queueAdapter.AsImmutable());
     }
 }
Ejemplo n.º 2
0
        public async Task StartPullingAgents(
            string streamProviderName,
            StreamQueueBalancerType balancerType,
            IQueueAdapter queueAdapter,
            TimeSpan getQueueMsgsTimerPeriod,
            TimeSpan initQueueTimeout)
        {
            IStreamQueueBalancer queueBalancer = StreamQueueBalancerFactory.Create(
                balancerType, streamProviderName, Silo.CurrentSilo.LocalSiloStatusOracle, this, queueAdapter.GetStreamQueueMapper());
            var managerId = GrainId.NewSystemTargetGrainIdByTypeCode(Constants.PULLING_AGENTS_MANAGER_SYSTEM_TARGET_TYPE_CODE);
            var manager   = new PersistentStreamPullingManager(managerId, streamProviderName, this, queueBalancer, getQueueMsgsTimerPeriod, initQueueTimeout);

            this.RegisterSystemTarget(manager);
            // Init the manager only after it was registered locally.
            var managerGrainRef = PersistentStreamPullingManagerFactory.Cast(manager.AsReference());
            // Need to call it as a grain reference though.
            await managerGrainRef.Initialize(queueAdapter.AsImmutable());
        }