Exemple #1
0
        public async Task Execute(IJobExecutionContext context)
        {
            var dataMap          = context.JobDetail.JobDataMap;
            var vkUserId         = dataMap.GetLongValue("vkUserId");
            var targetCategoryId = dataMap.GetLongValue("targetCategoryId");

            var generateMsg = GenerateMsg(targetCategoryId);
            await _msgSender.Send(generateMsg, vkUserId);
        }
Exemple #2
0
 public void Rollback()
 {
     try
     {
         using (var serviceScope = serviceProvider.GetService <IServiceScopeFactory>().CreateScope())
         {
             DbProvider = serviceProvider.GetService <ISagaDbProvider>();
             var conf = serviceScope.ServiceProvider.GetRequiredService <IConfiguration>();
             DbProvider.Commit(conf.GetConnectionString("DefaultConnection"), Id);
             MsgSender.Send(this.GetType().Name, Dto, SagaMessageType.Commit, Id, false);
         }
     }
     catch (Exception ex)
     {
         MsgSender.Send(this.GetType().Name, Dto, SagaMessageType.Rollback, Id, true);
     }
 }