从 Kafka 0.11.0.1 中的 _transaction_state 主题读取数据 [英] Reading data from _transaction_state topic in Kafka 0.11.0.1

查看:27
本文介绍了从 Kafka 0.11.0.1 中的 _transaction_state 主题读取数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想读取事务的元数据(Kafka 0.11.0.1 支持),以便我可以确定特定事务 ID 的事务是否已提交.目前我正在从 _transactional_state 主题获取键和值,但它采用某种编码格式.以下是我在轮询 __transaction_state 主题时收到的一些相同的键/值:键 = 10000000mmm,值 = +' )

I want to read meta data for transaction (which is supported in Kafka 0.11.0.1) so that I can figure out that whether the transaction for a particular transactional ID has been committed or not. Currently I am getting the key and value from _transactional_state topic but it is in some encoded format. Below are some same key/value I received when I polled __transaction_state topic: key = 10000000mmm, value = � �����+'���������)

推荐答案

您可以在 kafka/tools/DumpLogSegments.scala 文件中查看 TransactionLogMessageParser 类的源代码为一个例子.它使用 TransactionLog 类中的 readTxnRecordValue 函数.该函数的第一个参数可以通过同一个类的 readTxnRecordKey 函数获取.

You can look to source code of TransactionLogMessageParser class inside kafka/tools/DumpLogSegments.scala file as an example. It uses readTxnRecordValue function from TransactionLog class. The first argument for this function could be retrieved via readTxnRecordKey function of the same class.

这篇关于从 Kafka 0.11.0.1 中的 _transaction_state 主题读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆