コード例 #1
0
        /// <summary>
        /// Configure the background scheduler that updates the calendar in the background
        /// </summary>
        private static void SetUpBackgroundJob()
        {
            if (backgroundUpdateScheduler == null)
            {
                ISingularityFactory factory = new SingularityFactory();
                backgroundUpdateScheduler = factory.GetSingularity();
            }

            if (backgroundUpdateJob == null)
            {
                backgroundUpdateJob = new SimpleJob(scheduledTime => UpdateGoogleCalendar());
            }

            if (scheduledUpdateJob != null)
            {
                backgroundUpdateScheduler.StopScheduledJob(scheduledUpdateJob);
                scheduledUpdateJob = null;
                backgroundUpdateScheduler.Stop();
            }

            if (_runInMinutes > 0)
            {
                var schedule = new EveryXTimeSchedule(TimeSpan.FromMinutes(_runInMinutes));
                scheduledUpdateJob = backgroundUpdateScheduler.ScheduleJob(schedule, backgroundUpdateJob, true);
            }

            backgroundUpdateScheduler.Start();
        }
コード例 #2
0
ファイル: EventHorizon.cs プロジェクト: HammerAlf/Runtime
 /// <inheritdoc/>
 public void Collapse(ISingularity singularity)
 {
     lock (_singularities)
     {
         _logger.Information($"Quantum tunnel collapsed for singularity identified with bounded context '{singularity.BoundedContext}' in application '{singularity.Application}'");
         _singularities.Remove(singularity);
     }
 }
コード例 #3
0
ファイル: EventHorizon.cs プロジェクト: HammerAlf/Runtime
 /// <inheritdoc/>
 public void GravitateTowards(ISingularity singularity, IEnumerable <TenantOffset> tenantOffsets)
 {
     lock (_singularities)
     {
         _logger.Information($"Gravitate events in the event horizon towards singularity identified with bounded context '{singularity.BoundedContext}' in application '{singularity.Application}'");
         _singularities.Add(singularity);
         SendUnprocessedCommitsThroughSingularity(tenantOffsets, singularity);
     }
 }
コード例 #4
0
 void PassThroughSingularity(IEnumerable <Commits> commitsArray, ISingularity singularity)
 {
     commitsArray.ForEach(commits => {
         commits.ForEach(commit => {
             var committedEventStreamWithContext = new Processing.CommittedEventStreamWithContext(commit, commit.Events.First().Metadata.OriginalContext.ToExecutionContext(commit.CorrelationId));
             if (singularity.CanPassThrough(committedEventStreamWithContext))
             {
                 singularity.PassThrough(committedEventStreamWithContext);
             }
         });
     });
 }
コード例 #5
0
        /// <summary>
        /// Stops the background scheduler that updates the calendar in the background
        /// </summary>
        private static void EndBackgroundJob()
        {
            if (scheduledUpdateJob != null)
            {
                if (backgroundUpdateScheduler != null)
                {
                    backgroundUpdateScheduler.StopScheduledJob(scheduledUpdateJob);
                }
                scheduledUpdateJob = null;
            }

            if (backgroundUpdateScheduler != null)
            {
                backgroundUpdateScheduler.Stop();
                backgroundUpdateScheduler = null;
            }
        }
コード例 #6
0
        private void ScheduleClaymoreJob()
        {
            this.logger.LogDebug("Scheduling Claymore Job!");
            ISingularity singularity = Singularity.Instance;
            ISchedule    schedule    = new CronSchedule(settings.ClaymoreSchdeule);
            var          job         = new SimpleJob(scheduledTime => {
                this.logger.LogInformation("Executing claymore job!");
                this.claymoreClient.requestStats()
                .Subscribe(
                    (d) => {
                    try
                    {
                        var utcDateTime = DateTime.UtcNow;
                        var tuples      = d.ToMetrics(utcDateTime, this.settings.MetricsTopicPrefix);
                        foreach (var tuple in tuples)
                        {
                            this.metricsQueue.Add(tuple);
                        }
                        this.metricsQueue.Add(this.InjectWallet(utcDateTime));
                        this.logger.LogInformation("Claymore data queued!");
                    }
                    catch (Exception e)
                    {
                        this.logger.LogError("Failed to process claymore data: {0}", e);
                    }
                },
                    (e) => {
                    this.logger.LogError("Failed retrieving claymore data: {0}", e);
                    if (this.settings.ClaymoreShouldReboot)
                    {
                        this.ExecuteRebootCommand();
                    }
                },
                    () => {
                    this.logger.LogInformation("Claymore job completed!");
                }
                    );
            });
            var scheduledJob  = singularity.ScheduleJob(schedule, job, true);
            var nextExecution = schedule.NextScheduledTime(scheduledJob);

            singularity.Start();
            this.logger.LogDebug("Claymore Job scheduled with schedule: {0}!", schedule.ToString());
            this.logger.LogDebug("Claymore Job's next scheduled execution: {0}!", nextExecution);
        }
コード例 #7
0
 public ContestService(IContestRepository contestRepository, IPictureRepository pictureRepository, ISingularity singularity)
 {
     _contestRepository = contestRepository;
     _pictureRepository = pictureRepository;
     _singularity       = singularity;
 }
コード例 #8
0
ファイル: EventHorizon.cs プロジェクト: HammerAlf/Runtime
        void SendUnprocessedCommitsThroughSingularity(IEnumerable <TenantOffset> tenantOffsets, ISingularity singularity)
        {
            var commits = GetCommits(tenantOffsets);

            PassThroughSingularity(commits, singularity);
        }
コード例 #9
0
 public ShellWindowViewModel(ISingularity singularity)
 {
     _singularity       = singularity;
     this.JobCollection = new ObservableCollection <Job>();
     this.Load();
 }
コード例 #10
0
 public ChronitonController(ISingularity singularity, ITickerRepository marketCapDataInfosRepository, ITickerApi tickerApi)
 {
     _singularity = singularity;
     _marketCapDataInfosRepository = marketCapDataInfosRepository;
     _tickerApi = tickerApi;
 }
コード例 #11
0
 /// <inheritdoc/>
 public void GravitateTowards(ISingularity singularity)
 {
 }
コード例 #12
0
 /// <inheritdoc/>
 public void Collapse(ISingularity singularity)
 {
 }