public void Start() { var cts = new CancellationTokenSource(); // Streaming from a sequence is currently not implemented var streamRecords = new Voting.Record.StreamRecordsRequest(); var readStream = _recordServiceClient.StreamRecords(streamRecords, new CallOptions(cancellationToken: cts.Token)); HandleResponseStream(readStream); _shutdownService.RegisterShutdownCallback(() => { cts.Cancel(); }); }
public PollSummaryService( ILogger <PollSummaryService> logger, PubSubService pubSubService, StorageService redisService, ShutdownService shutdownService, RecordingServiceClient recordServiceClient ) { _logger = logger; _pubSubService = pubSubService; _storageService = redisService; _shutdownService = shutdownService; _recordServiceClient = recordServiceClient; _cancelTokenSource = new CancellationTokenSource(); // Streaming from a sequence is currently not implemented var streamRecords = new Voting.Record.StreamRecordsRequest(); var readStream = _recordServiceClient.StreamRecords(streamRecords, new CallOptions(cancellationToken: _cancelTokenSource.Token)); HandleResponseStream(readStream); shutdownService.RegisterShutdownCallback(() => { _cancelTokenSource.Cancel(); }); }