예제 #1
0
        private static CommittableMessage <K, V> CreateMessage(
            int seed,
            string topic,
            string groupId  = "group1",
            string metadata = "")
        {
            var offset = new GroupTopicPartitionOffset(new GroupTopicPartition(groupId, topic, 1), seed);
            var record = new Record
            {
                Topic     = offset.Topic,
                Partition = offset.Partition,
                Offset    = offset.Offset,
                Message   = new Message <string, string>
                {
                    Key   = seed.ToString(),
                    Value = seed.ToString()
                }
            };

            return(new CommittableMessage <string, string>(
                       record,
                       new CommittableOffset(ConsumerResultFactory.FakeCommiter, offset, metadata)));
        }
 internal static CommittableOffset CommittableOffset(GroupTopicPartitionOffset partitionOffset, string metadata)
 => new CommittableOffset(FakeCommiter, partitionOffset, metadata);
예제 #3
0
        /// <inheritdoc />
        public CommittableMessage <K, V> CreateMessage(ConsumeResult <K, V> record)
        {
            var offset = new GroupTopicPartitionOffset(GroupId, record.Topic, record.Partition, record.Offset);

            return(new CommittableMessage <K, V>(record, new CommittableOffset(Committer, offset, MetadataFromRecord(record))));
        }