lemonzone2010 opened a new issue #33: CPullConsumer  cannot pull message 
because of pullResult without nextBeginOffset
URL: https://github.com/apache/rocketmq-client-cpp/issues/33
 
 
   CPullConsumer  cannot pull message
   
   I check the 
[code](https://github.com/apache/rocketmq-client-cpp/blob/d5887b63ddbba16fec562f64dca7f77ce9ca0bb1/example/PullConsumeMessage.c#L68),found:
   ```c
    if (pullResult.pullStatus != E_BROKER_TIMEOUT) {
         tmpoffset = pullResult.nextBeginOffset;
    }
   ```
   The pullResult.nextBeginOffset will be store in tmpoffset when pullStatus is 
OFFSET_ILLEGAL.
   But the nextBeginOffset is not put in pullResult when pullStatus is 
OFFSET_ILLEGAL,see the following 
[code](https://github.com/apache/rocketmq-client-cpp/blob/d5887b63ddbba16fec562f64dca7f77ce9ca0bb1/src/extern/CPullConsumer.cpp#L202):
   ```c
       switch (cppPullResult.pullStatus) {
           case FOUND: {
               pullResult.pullStatus = E_FOUND;
               pullResult.maxOffset = cppPullResult.maxOffset;
               pullResult.minOffset = cppPullResult.minOffset;
               pullResult.nextBeginOffset = cppPullResult.nextBeginOffset;
               pullResult.size = cppPullResult.msgFoundList.size();
               PullResult *tmpPullResult = new PullResult(cppPullResult);
               pullResult.pData = tmpPullResult;
               //Alloc memory to save the pointer to CPP MQMessageExt, which 
will be release by the CPP SDK core.
               //Thus, this memory should be released by users using 
@ReleasePullResult
               pullResult.msgFoundList = (CMessageExt **) 
malloc(pullResult.size * sizeof(CMessageExt *));
               for (size_t i = 0; i < cppPullResult.msgFoundList.size(); i++) {
                   MQMessageExt *msg = const_cast<MQMessageExt 
*>(&tmpPullResult->msgFoundList[i]);
                   pullResult.msgFoundList[i] = (CMessageExt *) (msg);
               }
               break;
           }
           case NO_NEW_MSG: {
               pullResult.pullStatus = E_NO_NEW_MSG;
               break;
           }
           case NO_MATCHED_MSG: {
               pullResult.pullStatus = E_NO_MATCHED_MSG;
               break;
           }
           case OFFSET_ILLEGAL: {
               pullResult.pullStatus = E_OFFSET_ILLEGAL;
               break;
           }
           case BROKER_TIMEOUT: {
               pullResult.pullStatus = E_BROKER_TIMEOUT;
               break;
           }
           default:
               pullResult.pullStatus = E_NO_NEW_MSG;
               break;
   
       }
   ```
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to