You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@rocketmq.apache.org by li...@apache.org on 2022/06/30 09:32:12 UTC
[rocketmq-clients] branch cpp updated: Add error handling for Ack
This is an automated email from the ASF dual-hosted git repository.
lizhanhui pushed a commit to branch cpp
in repository https://gitbox.apache.org/repos/asf/rocketmq-clients.git
The following commit(s) were added to refs/heads/cpp by this push:
new f695a67 Add error handling for Ack
f695a67 is described below
commit f695a6756c4a5e72fc3b04e12e20d39365038fc5
Author: Li Zhanhui <li...@gmail.com>
AuthorDate: Thu Jun 30 17:32:04 2022 +0800
Add error handling for Ack
---
cpp/src/main/cpp/client/ClientManagerImpl.cpp | 71 ++++++++++++++++++++++++---
1 file changed, 64 insertions(+), 7 deletions(-)
diff --git a/cpp/src/main/cpp/client/ClientManagerImpl.cpp b/cpp/src/main/cpp/client/ClientManagerImpl.cpp
index 8562c6d..3f572b3 100644
--- a/cpp/src/main/cpp/client/ClientManagerImpl.cpp
+++ b/cpp/src/main/cpp/client/ClientManagerImpl.cpp
@@ -1010,23 +1010,80 @@ void ClientManagerImpl::ack(const std::string& target, const Metadata& metadata,
switch (status.code()) {
case rmq::Code::OK: {
SPDLOG_DEBUG("Ack OK. host={}", invocation_context->remote_address);
- } break;
+ break;
+ }
+
+ case rmq::Code::MULTIPLE_RESULTS: {
+ SPDLOG_DEBUG("Server returns multiple results. host={}", invocation_context->remote_address);
+ // Treat it as successful, allowing top tier processing according to response entries.
+ break;
+ }
+
+ case rmq::Code::ILLEGAL_TOPIC: {
+ SPDLOG_WARN("IllegalTopic: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::IllegalTopic;
+ break;
+ }
+
+ case rmq::Code::ILLEGAL_CONSUMER_GROUP: {
+ SPDLOG_WARN("IllegalConsumerGroup: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::IllegalConsumerGroup;
+ break;
+ }
+
+ case rmq::Code::INVALID_RECEIPT_HANDLE: {
+ SPDLOG_WARN("InvalidReceiptHandle: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::InvalidReceiptHandle;
+ break;
+ }
+
+ case rmq::Code::CLIENT_ID_REQUIRED: {
+ SPDLOG_WARN("ClientIdRequired: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::ClientIdRequired;
+ break;
+ }
+
+ case rmq::Code::TOPIC_NOT_FOUND: {
+ SPDLOG_WARN("TopicNotFound: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::TopicNotFound;
+ break;
+ }
+
case rmq::Code::UNAUTHORIZED: {
SPDLOG_WARN("Unauthorized: {}, host={}", status.message(), invocation_context->remote_address);
ec = ErrorCode::Unauthorized;
- } break;
+ break;
+ }
+
case rmq::Code::FORBIDDEN: {
SPDLOG_WARN("PermissionDenied: {}, host={}", status.message(), invocation_context->remote_address);
ec = ErrorCode::Forbidden;
- } break;
+ break;
+ }
+
+ case rmq::Code::TOO_MANY_REQUESTS: {
+ SPDLOG_WARN("TooManyRequests: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::TooManyRequests;
+ break;
+ }
+
case rmq::Code::INTERNAL_SERVER_ERROR: {
SPDLOG_WARN("InternalServerError: {}, host={}", status.message(), invocation_context->remote_address);
ec = ErrorCode::InternalServerError;
- } break;
+ break;
+ }
+
+ case rmq::Code::PROXY_TIMEOUT: {
+ SPDLOG_WARN("GatewayTimeout: {}, host={}", status.message(), invocation_context->remote_address);
+ ec = ErrorCode::GatewayTimeout;
+ break;
+ }
+
default: {
- SPDLOG_WARN("NotImplement: please upgrade SDK to latest release. host={}", invocation_context->remote_address);
- ec = ErrorCode::NotImplemented;
- } break;
+ SPDLOG_WARN("NotSupported: please upgrade SDK to latest release. host={}", invocation_context->remote_address);
+ ec = ErrorCode::NotSupported;
+ break;
+ }
}
cb(ec);
};