Skip to content

CPullConsumer cannot pull message because of pullResult without nextBeginOffset #33

@lemonzone2010

Description

@lemonzone2010

CPullConsumer cannot pull message

I check the code,found:

 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:

    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;

    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions