rocketmq-client-cpp icon indicating copy to clipboard operation
rocketmq-client-cpp copied to clipboard

bug, should rethrow error

Open shuyanzhu opened this issue 5 years ago • 11 comments

https://github.com/apache/rocketmq-client-cpp/blob/a42de735a3319a859f6108c9e714ed715fe45969/src/consumer/DefaultMQPullConsumerImpl.cpp#L290

shuyanzhu avatar Nov 28 '20 12:11 shuyanzhu

It looks like the code has some issue, and I think call callback function is better.

ifplusor avatar Nov 28 '20 22:11 ifplusor

User should catch this exception and may call the PullCallback::onException(MQException &), and then delete call back if it was allocated in heap when PullCallback::onException(MQException &) don't "delete this", just like the code in send message( another issue in send user should konw is the AutoDeleteSendCallback don't work normally in this case because it is called by SendCallbackWrap::onException ). It's my opinion.

https://github.com/apache/rocketmq-client-cpp/blob/a42de735a3319a859f6108c9e714ed715fe45969/src/producer/DefaultMQProducerImpl.cpp#L248

shuyanzhu avatar Nov 29 '20 03:11 shuyanzhu

I mean all PulCalllbacks which were allocated in heap need to "delete this" in onSuccess or onException because there is no AutoDeletePullCallback to be inherited by user. SendCallback does has AutoDeleteSendCallback, but if there is exception occurs in send AutoDeleteSendCallback don't work, so user should catch exceptions and delete SendCallback mannually. I am confused why PullCallback doesn't has AutoDelete like SendCallback:

https://github.com/apache/rocketmq-client-cpp/blob/87350727950d1ece9ed3ffab414bbe0f673eeaac/include/AsyncCallback.h#L39

shuyanzhu avatar Nov 29 '20 03:11 shuyanzhu

@ShannonDing ping

vongosling avatar Nov 30 '20 02:11 vongosling

Maybe I make a pr when I'm free?

shuyanzhu avatar Dec 01 '20 16:12 shuyanzhu

@shuyanzhu Welcome to PR.

ifplusor avatar Dec 01 '20 23:12 ifplusor

@shuyanzhu I check this issue again, and I think the version of re_dev branch meets your expectations.

ifplusor avatar Jan 27 '21 08:01 ifplusor

Looks like there is no pull API anymore, nice(Doge)

shuyanzhu avatar Jan 27 '21 08:01 shuyanzhu

Should I close this issue?

shuyanzhu avatar Jan 27 '21 08:01 shuyanzhu

Looks like there is no pull API anymore, nice(Doge)

A new LitePullConsumer is wip.

ifplusor avatar Jan 27 '21 08:01 ifplusor

Should I close this issue?

Improving the master branch is also beneficial, welcome to PR.

ifplusor avatar Jan 27 '21 08:01 ifplusor