示例#1
0
 /// <summary>
 /// Starts the stream processing for all tenants.
 /// </summary>
 /// <returns>A <see cref="Task"/> representing the asynchronous operation.</returns>
 public async Task Start()
 {
     if (!_initialized)
     {
         throw new StreamProcessorNotInitialized(_identifier);
     }
     if (_started)
     {
         throw new StreamProcessorAlreadyProcessingStream(_identifier);
     }
     _unregisterTokenRegistration.Dispose();
     _started = true;
     try
     {
         await _streamProcessor.Start(_cancellationToken).ConfigureAwait(false);
     }
     catch (Exception ex)
     {
         if (!_cancellationToken.IsCancellationRequested)
         {
             _logger.Warning(ex, "Subscription: {SubscriptionId} failed", _identifier);
         }
     }
     finally
     {
         _unregister();
     }
 }
示例#2
0
 protected static Task start_stream_processor_and_cancel_after(TimeSpan cancelAfter)
 {
     cancellation_token_source.CancelAfter(cancelAfter);
     return(stream_processor.Start(cancellation_token_source.Token));
 }