@Override
public void gotoCheck(int producerGroupHashCode, long tranStateTableOffset, long commitLogOffset,
int msgSize) {
// 第一步、查询Producer
final ClientChannelInfo clientChannelInfo =
this.brokerController.getProducerManager().pickProducerChannelRandomly(producerGroupHashCode);
if (null == clientChannelInfo) {
log.warn("check a producer transaction state, but not find any channel of this group[{}]",
producerGroupHashCode);
return;
}
// 第二步、查询消息
SelectMapedBufferResult selectMapedBufferResult =
this.brokerController.getMessageStore().selectOneMessageByOffset(commitLogOffset, msgSize);
if (null == selectMapedBufferResult) {
log.warn(
"check a producer transaction state, but not find message by commitLogOffset: {}, msgSize: ",
commitLogOffset, msgSize);
return;
}
// 第三步、向Producer发起请求
final CheckTransactionStateRequestHeader requestHeader = new CheckTransactionStateRequestHeader();
requestHeader.setCommitLogOffset(commitLogOffset);
requestHeader.setTranStateTableOffset(tranStateTableOffset);
this.brokerController.getBroker2Client().checkProducerTransactionState(
clientChannelInfo.getChannel(), requestHeader, selectMapedBufferResult);
}