コード例 #1
0
ファイル: MessageQueueJob.cs プロジェクト: 2644783865/alabo
        protected override async Task Execute(IJobExecutionContext context, IScope scope)
        {
            FirstWaiter(context, scope, TimeSpan.FromMinutes(5));
            var config = scope.Resolve <IConfiguration>();

            _restClientConfiugration = new RestClientConfiguration(config);
            _messageApiClient        = new MessageApiClient(_restClientConfiugration.OpenApiUrl);
            _adminMessageApiClient   = new AdminMessageApiClient(_restClientConfiugration.OpenApiUrl);

            var objectCache = scope.Resolve <IObjectCache>();

            objectCache.TryGet("MessageIsAllSend_Cache", out bool sendState);
            if (sendState == false)
            {
                scope.Resolve <IObjectCache>().Set("MessageIsAllSend_Cache", true);
                var messageQueueService = scope.Resolve <IMessageQueueService>();
                var unHandledIdList     = messageQueueService.GetUnHandledIdList();
                if (unHandledIdList != null && unHandledIdList.Count > 0)
                {
                    foreach (var id in unHandledIdList)
                    {
                        try {
                            await HandleQueueAsync(messageQueueService, id);
                        } catch (Exception ex) {
                            scope.Resolve <IObjectCache>().Set("MessageIsAllSend_Cache", false);
                            throw new ArgumentNullException(ex.Message);
                        }
                    }
                }
            }
        }
コード例 #2
0
 public EmployeeFacadeApiClient(
     IApplicationRoleApiClient applicationRoleApiClient,
     IPermissionApiClient PermissionApiClient,
     ITaskApiClient calendarTaskApiClient,
     IChatMessageApiClient chatMessageApiClient,
     IMenuItemApiClient menuItemApiClient,
     IMessageApiClient messageApiClient,
     IRoleApiClient roleApiClient,
     IUserActivityApiClient userActivityApiClient,
     IUserApplicationRoleApiClient userApplicationRoleApiClient,
     IUserPersonTaskApiClient userTaskApiClient,
     IUserTaskNotificationApiClient userCalendarTaskNotificationApiClient,
     IUserTaskReminderApiClient userCalendarTaskReminderApiClient,
     IUserApiClient userApiClient,
     IUserDiaryApiClient userDiaryApiClient,
     IUserGroupApiClient userGroupApiClient,
     IUserMessageApiClient userMessageApiClient,
     IUserDocumentApiClient userDocumentApiClient,
     IUserEmailApiClient userEmailApiClient,
     IUserSmsApiClient userSmsApiClient,
     IWebApplicationApiClient webApplicationApiClient
     )
 {
     _applicationRoleApiClient              = applicationRoleApiClient;
     _PermissionApiClient                   = PermissionApiClient;
     _calendarTaskApiClient                 = calendarTaskApiClient;
     _chatMessageApiClient                  = chatMessageApiClient;
     _menuItemApiClient                     = menuItemApiClient;
     _messageApiClient                      = messageApiClient;
     _roleApiClient                         = roleApiClient;
     _userActivityApiClient                 = userActivityApiClient;
     _userApplicationRoleApiClient          = userApplicationRoleApiClient;
     _userTaskApiClient                     = userTaskApiClient;
     _userCalendarTaskNotificationApiClient = userCalendarTaskNotificationApiClient;
     _userCalendarTaskReminderApiClient     = userCalendarTaskReminderApiClient;
     _userApiClient                         = userApiClient;
     _userDiaryApiClient                    = userDiaryApiClient;
     _userGroupApiClient                    = userGroupApiClient;
     _userMessageApiClient                  = userMessageApiClient;
     _userDocumentApiClient                 = userDocumentApiClient;
     _userSmsApiClient                      = userSmsApiClient;
     _userEmailApiClient                    = userEmailApiClient;
     _webApplicationApiClient               = webApplicationApiClient;
 }