예제 #1
0
        private async Task CommitOne(CommitMsg commit)
        {
            try
            {
                await
                _consumerGroup.Commit(
                    Enumerable.Repeat(
                        new TopicData <OffsetCommitPartitionData>
                {
                    TopicName      = commit.Topic,
                    PartitionsData =
                        Enumerable.Repeat(
                            new OffsetCommitPartitionData
                    {
                        Partition = commit.Partition,
                        Offset    = commit.Offset,
                        Metadata  = ""
                    }, 1)
                }, 1));

                commit.CommitPromise.SetResult(true);
            }
            catch (Exception ex)
            {
                _cluster.Logger.LogError("Exception caught while trying to commit offsets. " + ex);
                commit.CommitPromise.SetException(ex);
            }
        }
예제 #2
0
 private Task CheckCommit(CommitMsg commit)
 {
     return(commit != null?CommitOne(commit) : _commitRequired?CommitAll() : Task.CompletedTask);
 }