state主题读取数据

state主题读取数据

本文介绍了从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主题读取数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-21 01:45