Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion src/MQClientAPIImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,11 @@ SendResult MQClientAPIImpl::sendMessage(const string& addr,
int communicationMode,
SendCallback* pSendCallback,
const SessionCredentials& sessionCredentials) {
RemotingCommand request(SEND_MESSAGE, pRequestHeader);
// RemotingCommand request(SEND_MESSAGE, pRequestHeader);
// Using MQ V2 Protocol to end messages.
SendMessageRequestHeaderV2* pRequestHeaderV2 = new SendMessageRequestHeaderV2(*pRequestHeader);
RemotingCommand request(SEND_MESSAGE_V2, pRequestHeaderV2);
delete pRequestHeader; // delete to avoid memory leak.
string body = msg.getBody();
request.SetBody(body.c_str(), body.length());
request.setMsgBody(body);
Expand Down
5 changes: 4 additions & 1 deletion src/MQClientFactory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include "ConsumerRunningInfo.h"
#include "Logging.h"
#include "MQClientManager.h"
#include "MQVersion.h"
#include "PullRequest.h"
#include "Rebalance.h"
#include "TopicPublishInfo.h"
Expand Down Expand Up @@ -1161,7 +1162,9 @@ ConsumerRunningInfo* MQClientFactory::consumerRunningInfo(const string& consumer
} else {
runningInfo->setProperty(ConsumerRunningInfo::PROP_CONSUME_TYPE, "CONSUME_ACTIVELY");
}
runningInfo->setProperty(ConsumerRunningInfo::PROP_CLIENT_VERSION, "V3_1_8"); // MQVersion::s_CurrentVersion ));
runningInfo->setProperty(
ConsumerRunningInfo::PROP_CLIENT_VERSION,
MQVersion::GetVersionDesc(MQVersion::s_CurrentVersion)); // MQVersion::s_CurrentVersion ));

return runningInfo;
}
Expand Down
1 change: 0 additions & 1 deletion src/common/AsyncCallbackWrap.cpp
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include "MQClientAPIImpl.h"
#include "MQDecoder.h"
#include "MQMessageQueue.h"
#include "MQProtos.h"
#include "PullAPIWrapper.h"
#include "PullResultExt.h"
#include "ResponseFuture.h"
Expand Down
7 changes: 3 additions & 4 deletions src/common/AsyncCallbackWrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,14 @@
#include "AsyncArg.h"
#include "AsyncCallback.h"
#include "MQMessage.h"
#include "UtilAll.h"
#include "RemotingCommand.h"
#include "UtilAll.h"

namespace rocketmq {

class ResponseFuture;
class MQClientAPIImpl;
class DefaultMQProducer;
class SendMessageRequestHeader;
//<!***************************************************************************
enum asyncCallBackType { asyncCallbackWrap = 0, sendCallbackWrap = 1, pullCallbackWarp = 2 };

Expand Down Expand Up @@ -77,5 +76,5 @@ class PullCallbackWarp : public AsyncCallbackWrap {
};

//<!***************************************************************************
} //<!end namespace;
#endif //<! _AsyncCallbackWrap_H_
} // namespace rocketmq
#endif // __ASYNCCALLBACKWRAP_H__
18 changes: 11 additions & 7 deletions src/common/MQVersion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,19 @@
#include "MQVersion.h"

namespace rocketmq {
int MQVersion::s_CurrentVersion = MQVersion::V3_1_8;
int MQVersion::s_CurrentVersion = MQVersion::V4_6_0;
std::string MQVersion::s_CurrentLanguage = "CPP";

//<!************************************************************************
const char* MQVersion::getVersionDesc(int value) {
switch (value) {
// case V1_0_0:
// return "V1_0_0";
const char* MQVersion::GetVersionDesc(int value) {
int currentVersion = value;
if (value <= V3_0_0_SNAPSHOT) {
currentVersion = V3_0_0_SNAPSHOT;
}
return "";
if (value >= HIGHER_VERSION) {
currentVersion = HIGHER_VERSION;
}
return RocketMQCPPClientVersion[currentVersion];
}
//<!***************************************************************************
} //<!end namespace;
} // namespace rocketmq
Loading