当前位置:   article > 正文

转载 ---kafka集群消费之ConsumerRecord类

consumerrecord


  • public final class ConsumerRecord <K,V> 
    extends Object
    从Kafka收到的键/值对。这包括主题名称和分区号,从中接收记录以及指向Kafka分区中记录的偏移量。
    • 构造函数摘要

      构造函数  
      构造函数和描述
      ConsumerRecord(String topic, int partition, long offset, K key, V value)
      创建从指定主题和分区接收的记录(在消息格式支持的时间戳之前和公开序列化元数据之前提供与Kafka 0.9的兼容性)。
      ConsumerRecord(String topic, int partition, long offset, long timestamp, org.apache.kafka.common.record.TimestampType timestampType, long checksum, int serializedKeySize, int serializedValueSize, K key, V value)
      创建从指定主题和分区接收的记录
    • 现场细节

      • NO_TIMESTAMP
        public static final long NO_TIMESTAMP
        也可以看看:
        常数字段值
      • NULL_SIZE
        public static final int NULL_SIZE
        也可以看看:
        常数字段值
      • NULL_CHECKSUM
        public static final int NULL_CHECKSUM
        也可以看看:
        常数字段值
    • 构造函数详细信息

      • ConsumerRecord
        public ConsumerRecord(String  topic,
                      int分区,
                      长偏移,
                      K  键,
                       V  值)
        创建从指定主题和分区接收的记录(在消息格式支持的时间戳之前和公开序列化元数据之前提供与Kafka 0.9的兼容性)。
        参数:
        topic - 收到此记录的主题
        partition - 收到此记录的主题分区
        offset - 此记录在相应Kafka分区中的偏移量
        key - 记录的密钥(如果存在)(允许为null)
        value - 记录内容
      • ConsumerRecord
        public ConsumerRecord(String  topic,
                      int分区,
                      长偏移,
                      很长的时间戳,
                      org.apache.kafka.common.record.TimestampType timestampType,
                      长校验和,
                      int serializedKeySize,
                      int serializedValueSize,
                      K  键,
                       V  值)
        创建从指定主题和分区接收的记录
        参数:
        topic - 收到此记录的主题
        partition - 收到此记录的主题分区
        offset - 此记录在相应Kafka分区中的偏移量
        timestamp - 记录的时间戳。
        timestampType - 时间戳类型
        checksum - 完整记录的校验和(CRC32)
        serializedKeySize - 序列化密钥的长度
        serializedValueSize - 序列化值的长度
        key - 记录的密钥(如果存在)(允许为null)
        value - 记录内容
    • 方法细节

      • 话题
        public  String  topic()
        收到此记录的主题
      • 划分
        public int partition()
        从中接收此记录的分区
      • 公钥  K  键()
        密钥(如果未指定密钥,则为null)
      • 公共  V  值()
        价值
      • 抵消
        公共长偏移量()
        此记录在相应Kafka分区中的位置。
      • 时间戳
        公共长时间戳()
        此记录的时间戳
      • timestampType
        public org.apache.kafka.common.record.TimestampType timestampType()
        此记录的时间戳类型
      • 校验
        公共长校验和()
        记录的校验和(CRC32)。
      • serializedKeySize
        public int serializedKeySize()
        序列化未压缩密钥的大小(以字节为单位)。如果key为null,则返回的大小为-1。
      • serializedValueSize
        public int serializedValueSize()
        序列化未压缩值的大小(以字节为单位)。如果value为null,则返回的大小为-1。
                                </div><div><div></div></div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-60ecaf1f42.css" rel="stylesheet">
                                            <div class="more-toolbox">
            <div class="left-toolbox">
                <ul class="toolbox-list">
                    
                    <li class="tool-item tool-active is-like "><a href="javascript:;"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#csdnc-thumbsup"></use>
                    </svg><span class="name">点赞</span>
                    <span class="count"></span>
                    </a></li>
                    <li class="tool-item tool-active is-collection "><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;popu_824&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-Collection-G"></use>
                    </svg><span class="name">收藏</span></a></li>
                    <li class="tool-item tool-active is-share"><a href="javascript:;" data-report-click="{&quot;mod&quot;:&quot;1582594662_002&quot;}"><svg class="icon" aria-hidden="true">
                        <use xlink:href="#icon-csdnc-fenxiang"></use>
                    </svg>分享</a></li>
                    <!--打赏开始-->
                                            <!--打赏结束-->
                                            <li class="tool-item tool-more">
                        <a>
                        <svg t="1575545411852" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5717" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><defs><style type="text/css"></style></defs><path d="M179.176 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5718"></path><path d="M509.684 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5719"></path><path d="M846.175 499.222m-113.245 0a113.245 113.245 0 1 0 226.49 0 113.245 113.245 0 1 0-226.49 0Z" p-id="5720"></path></svg>
                        </a>
                        <ul class="more-box">
                            <li class="item"><a class="article-report">文章举报</a></li>
                        </ul>
                    </li>
                                        </ul>
            </div>
                        </div>
        <div class="person-messagebox">
            <div class="left-message"><a href="https://blog.csdn.net/qq_37191690">
                <img src="https://profile.csdnimg.cn/6/2/D/3_qq_37191690" class="avatar_pic" username="qq_37191690">
                                        <img src="https://g.csdnimg.cn/static/user-reg-year/1x/3.png" class="user-years">
                                </a></div>
            <div class="middle-message">
                                    <div class="title"><span class="tit"><a href="https://blog.csdn.net/qq_37191690" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}" target="_blank">一个小小bug</a></span>
                                        </div>
                <div class="text"><span>发布了3 篇原创文章</span> · <span>获赞 6</span> · <span>访问量 1万+</span></div>
            </div>
                            <div class="right-message">
                                        <a href="https://im.csdn.net/im/main.html?userName=qq_37191690" target="_blank" class="btn btn-sm btn-red-hollow bt-button personal-letter">私信
                    </a>
                                                        <a class="btn btn-sm  bt-button personal-watch" data-report-click="{&quot;mod&quot;:&quot;popu_379&quot;}">关注</a>
                                </div>
                        </div>
                </div>
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号