Exemple #1
0
 public void Application_End(object sender, EventArgs e)
 {
     EventsHub.RaiseApplicationEnd();
     ScheduleThread.StopScheduleThread();
     ScheduleThread.NumberOfSessions = 0;
     LogManager.GetLogger(GetType()).Info("Application end!");
 }
 public CirrusWalletInfoBroadcaster(
     ILoggerFactory loggerFactory,
     IWalletService walletService,
     IAsyncProvider asyncProvider,
     INodeLifetime nodeLifetime,
     EventsHub eventsHub)
     : base(loggerFactory, walletService, asyncProvider, nodeLifetime, eventsHub, true)
 {
 }
 public StakingBroadcaster(
     ILoggerFactory loggerFactory,
     IPosMinting posMinting,
     INodeLifetime nodeLifetime,
     IAsyncProvider asyncProvider,
     EventsHub eventsHub)
     : base(eventsHub, loggerFactory, nodeLifetime, asyncProvider)
 {
     this.posMinting = posMinting;
 }
Exemple #4
0
 private void UserAccessCheck()
 {
     try
     {
         EventsHub.RaiseUserAuthenticating(HttpContext.Current.User.Identity.Name);
     }
     catch (Exception e)
     {
         BaseViewPage <int> .SendSecurityErrorReponse(e.InnerException == null?e.Message : e.InnerException.Message);
     }
 }
Exemple #5
0
 protected ClientBroadcasterBase(
     EventsHub eventsHub,
     ILoggerFactory loggerFactory,
     INodeLifetime nodeLifetime,
     IAsyncProvider asyncProvider)
 {
     this.eventsHub     = eventsHub;
     this.nodeLifetime  = nodeLifetime;
     this.asyncProvider = asyncProvider;
     this.logger        = loggerFactory.CreateLogger(this.GetType().FullName);
 }
 public WalletInfoBroadcaster(
     ILoggerFactory loggerFactory,
     IWalletService walletService,
     IAsyncProvider asyncProvider,
     INodeLifetime nodeLifetime,
     EventsHub eventsHub, bool includeAddressBalances = false)
     : base(eventsHub, loggerFactory, nodeLifetime, asyncProvider)
 {
     this.walletService          = walletService;
     this.includeAddressBalances = includeAddressBalances;
 }
Exemple #7
0
        protected void Application_Error(object sender, EventArgs e)
        {
            // Get the exception object.
            var exc = Server.GetLastError();

            // Log the exception and notify system operators
            LogManager.GetLogger(GetType()).Error($"Error in: {HttpContext.Current?.Request?.Url}", exc);
            // Raise the ApplicationError Event
            EventsHub.RaiseApplicationError(exc);
            // Clear the error from the server
            Server.ClearError();
        }
Exemple #8
0
 protected void Session_Start(object sender, EventArgs e)
 {
     if (!Session.IsNewSession)
     {
         return;
     }
     ScheduleThread.CheckScheduleThreadStatus(HttpContext.Current);
     ScheduleThread.NumberOfSessions++;
     LogManager.GetLogger(GetType()).InfoFormat("Session: {0} started, user:{1} (Number Of Sessions: {2})",
                                                Session.SessionID,
                                                User.Identity.Name,
                                                ScheduleThread.NumberOfSessions);
     EventsHub.RaiseSessionStart();
 }
 public WalletInfoBroadcaster(
     ILoggerFactory loggerFactory,
     IWalletManager walletManager,
     IConnectionManager connectionManager,
     IAsyncProvider asyncProvider,
     INodeLifetime nodeLifetime,
     ChainIndexer chainIndexer,
     EventsHub eventsHub)
     : base(eventsHub, loggerFactory, nodeLifetime, asyncProvider)
 {
     this.walletManager     = walletManager;
     this.connectionManager = connectionManager;
     this.chainIndexer      = chainIndexer;
 }
Exemple #10
0
        public async Task Consume(ConsumeContext <ICurriculumUpdated> context)
        {
            var curriculum    = context.Message.Curriculum;
            var curriculumDto = curriculum.MapTo <Data.Models.Curriculum>();

            _logger.LogInformation("Update curriculum {0}", JsonSerializer.Serialize(curriculum));
            _logger.LogInformation("Update curriculumDto {0}", JsonSerializer.Serialize(curriculumDto));
            var studentCurriculums =
                (await _studentCurriculumService.ListAsync(x => x.Curriculum.Id == curriculum.Id)).ToList();

            _logger.LogInformation("update {0} student curriculums with curriculum id of {1}",
                                   studentCurriculums.Count(), curriculum.Id);
            for (var i = 0; i < studentCurriculums.Count; i++)
            {
                studentCurriculums[i].Curriculum = curriculumDto;
                await _studentCurriculumService.UpdateAsync(studentCurriculums[i]);
            }

            await _hubContext.Clients.Group(EventsHub.GetGroupName(GroupType.Field, curriculum.Field.Id))
            .CurriculumUpdated(curriculum.Id, curriculumDto);
        }
Exemple #11
0
 public async Task Consume(ConsumeContext <ICurriculumCapacityCompleted> context)
 {
     _logger.LogInformation("curriculum capacity of {0} is completed. sending this message to socket", context.Message.CurriculumId);
     await _hubContext.Clients.Group(EventsHub.GetGroupName(GroupType.Field, context.Message.FieldId))
     .CurriculumCompleted(context.Message.CurriculumId);
 }