[Feature] Support producer transaction message by jonnxu · Pull Request #154 · apache/rocketmq-client-cpp

What is the purpose of the change

Support producer transaction message

Brief changelog

realize the transaction message feature

Verifying this change

executeLocalTransaction enter msg:Message [topic=trans_topic, flag=0, tag=]
executeLocalTransaction transactionId:010011AC0000D95B0000AF8B32130100, return state: 2
sendMessageInTransaction msgId: 010011AC0000D95B0000AF8B32130100
send RT more than: 2808 ms with msgid: 010011AC0000D95B0000AF8B32130100
checkLocalTransaction enter msg:MessageExt [queueId=0, storeSize=279, queueOffset=52809, sysFlag=0, bornTimestamp=1559554079663, bornHost=101.132.96.164, storeTimestamp=1559554081065, storeHost=101.132.96.164, msgId=010011AC0000D95B0000AF8B32130100, commitLogOffset=154611164, bodyCRC=1850051804, reconsumeTimes=0, preparedTransactionOffset=0, Message [topic=trans_topic, flag=0, tag=
]]
checkLocalTransaction transactionId:010011AC0000D95B0000AF8B32130100, return state: COMMIT_MESSAGE

2019-06-03 17:58:37 INFO SendMessageThread_1 - Transaction request:EndTransactionRequestHeader{producerGroup='yyy', tranStateTableOffset=52814, commitLogOffset=154612619, commitOrRollback=0, fromTransactionCheck=false, msgId='010011AC0000182600003F924E130100', transactionId=''}
2019-06-03 17:58:37 WARN SendMessageThread_1 - The producer[101.132.96.164:44820] end transaction in sending message, and it's pending status.RequestHeader: EndTransactionRequestHeader{producerGroup='yyy', tranStateTableOffset=52814, commitLogOffset=154612619, commitOrRollback=0, fromTransactionCheck=false, msgId='010011AC0000182600003F924E130100', transactionId=''} Remark:
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - Begin to check prepare message, begin time:1559555971143
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - Check topic=RMQ_SYS_TRANS_HALF_TOPIC, queues=[MessageQueue [topic=RMQ_SYS_TRANS_HALF_TOPIC, brokerName=broker-a, queueId=0]]
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - Before check, the queue=MessageQueue [topic=RMQ_SYS_TRANS_HALF_TOPIC, brokerName=broker-a, queueId=0] msgOffset=52814 opOffset=36
2019-06-03 17:59:31 WARN TransactionalMessageCheckService - Offset illegal. GetMessageStatus=OFFSET_OVERFLOW_ONE, topic=RMQ_SYS_TRANS_OP_HALF_TOPIC, groupId=CID_RMQ_SYS_TRANS, requestOffset=36
2019-06-03 17:59:31 WARN TransactionalMessageCheckService - The miss op offset=36 in queue=MessageQueue [topic=RMQ_SYS_TRANS_OP_HALF_TOPIC, brokerName=broker-a, queueId=0] is illegal, pullResult=PullResult [pullStatus=OFFSET_ILLEGAL, nextBeginOffset=36, minOffset=0, maxOffset=36, msgFoundList=0]
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - Send check message, the offset=52814 restored in queueOffset=52815 commitLogOffset=154612884 newMsgId=658460A400002A9F0000000009373494 realMsgId=010011AC0000182600003F924E130100 topic=RMQ_SYS_TRANS_HALF_TOPIC
2019-06-03 17:59:31 WARN TransactionalMessageCheckService - Offset illegal. GetMessageStatus=OFFSET_OVERFLOW_ONE, topic=RMQ_SYS_TRANS_HALF_TOPIC, groupId=CID_RMQ_SYS_TRANS, requestOffset=52815
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - Illegal offset, the miss offset=52815 in=MessageQueue [topic=RMQ_SYS_TRANS_HALF_TOPIC, brokerName=broker-a, queueId=0], continue check=2, pull result=PullResult [pullStatus=OFFSET_ILLEGAL, nextBeginOffset=52815, minOffset=0, maxOffset=52815, msgFoundList=0]
2019-06-03 17:59:31 WARN TransactionalMessageCheckService - Offset illegal. GetMessageStatus=OFFSET_OVERFLOW_ONE, topic=RMQ_SYS_TRANS_HALF_TOPIC, groupId=CID_RMQ_SYS_TRANS, requestOffset=52815
2019-06-03 17:59:31 INFO TransactionalMessageCheckService - End to check prepare message, consumed time:0
2019-06-03 17:59:31 INFO SendMessageThread_1 - Transaction request:EndTransactionRequestHeader{producerGroup='yyy', tranStateTableOffset=52815, commitLogOffset=154612884, commitOrRollback=8, fromTransactionCheck=false, msgId='010011AC0000182600003F924E130100', transactionId='010011AC0000182600003F924E130100'}
2019-06-03 17:59:31 INFO SendMessageThread_1 - Transaction op message write successfully. messageId=658460A400002A9F0000000009373494, queueId=0 msgExt:MessageExt [queueId=0, storeSize=291, queueOffset=52815, sysFlag=0, bornTimestamp=1559555916351, bornHost=/101.132.96.164:44820, storeTimestamp=1559555971143, storeHost=/101.132.96.164:10911, msgId=658460A400002A9F0000000009373494, commitLogOffset=154612884, bodyCRC=1850051804, reconsumeTimes=0, preparedTransactionOffset=0, toString()=Message{topic='RMQ_SYS_TRANS_HALF_TOPIC', flag=0, properties={TRANSACTION_CHECK_TIMES=1, TRAN_MSG=true, UNIQ_KEY=010011AC0000182600003F924E130100, PGROUP=yyy, WAIT=true, TAGS=*}, body=[97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 97, 109, 115, 103, 98, 111, 100, 121, 32, 102, 111, 114, 32, 116, 101, 115, 116], transactionId='null'}]

Follow this checklist to help us incorporate your contribution quickly and easily. Notice, it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR.

  • Make sure there is a Github issue filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Format the pull request title like [ISSUE #123] Fix UnknownException when host config not exist. Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when a cross-module dependency exists.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.