示例#1
0
        public void OnNext(PersistentSubscriptionResetEvent value)
        {
            try
            {
                var worker = Task.Factory
                             .StartNew(async() =>
                {
                    using (var scope = _serviceProvider.CreateScope())
                    {
                        var handler = scope.ServiceProvider.GetRequiredService <IPersistentSubscriptionResetHandler <TProfile> >();
                        await handler.HandleReset();
                    }
                });

                worker.Wait();
            }
            catch (AggregateException ae)
            {
                //Check if the task threw any exceptions that we're concerned with
                foreach (var e in ae.InnerExceptions)
                {
                    throw;
                }
            }
        }
 public void OnNext(PersistentSubscriptionResetEvent value)
 {
     using (var scope = _serviceProvider.CreateScope())
     {
         var stateRepository = scope.ServiceProvider.GetRequiredService <IPartitionedProjectionStateRepository <TProjection> >();
         stateRepository.ResetState().Wait();
     }
 }