コード例 #1
0
        // ReSharper disable once ParameterHidesMember
        protected private async Task <StreamCoordinates> SeekToEndAsync(StreamShardingSettings shardingSettings)
        {
            var query = new SeekToEndStreamQuery(settings.StreamName)
            {
                ClientShard      = shardingSettings.ClientShardIndex,
                ClientShardCount = shardingSettings.ClientShardCount
            };

            SeekToEndStreamResult result;

            using (var spanBuilder = tracer.BeginConsumerCustomOperationSpan("SeekToEnd"))
            {
                do
                {
                    result = await client.SeekToEndAsync(query, settings.ApiKeyProvider(), settings.EventsReadTimeout).ConfigureAwait(false);

                    if (!result.IsSuccessful)
                    {
                        log.Warn(
                            "Failed to seek to end for Hercules stream '{StreamName}'. " +
                            "Status: {Status}. Error: '{Error}'.",
                            settings.StreamName,
                            result.Status,
                            result.ErrorDetails);
                        await DelayOnError().ConfigureAwait(false);
                    }
                } while (!result.IsSuccessful);

                spanBuilder.SetStream(query.Name);
                spanBuilder.SetShard(query.ClientShard, query.ClientShardCount);
            }

            return(result.Payload.Next);
        }
コード例 #2
0
 public Task <SeekToEndStreamResult> SeekToEndAsync(SeekToEndStreamQuery query, TimeSpan timeout, CancellationToken cancellationToken = new CancellationToken()) =>
 client.SeekToEndAsync(query, settings.ApiKeyProvider(), timeout, cancellationToken);