private async Task Run(ISinkQueue <ImmutableList <Transaction> > queue)
            {
                while (!_isCancel.Value)
                {
                    try
                    {
                        var data = await queue.PullAsync();

                        if (data.HasValue)
                        {
                            await _subscriber.HandleTransactions(data.Value, new SubscriptionInfo
                            {
                                Id           = data.Value.Last().StreamId,
                                Subscription = this
                            });
                        }
                        else
                        {
                            Thread.Sleep(1);
                        }
                    }
                    catch (Exception e)
                    {
                        _errorHandler?.Invoke(_exceptionInfo, e);
                    }
                }
            }
예제 #2
0
        public async Task PlainSinkThroughput()
        {
            var result = await _sink.PullAsync();

            if (!result.HasValue)
            {
                Console.WriteLine("Consume timed out.");
            }
        }