You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2022/09/19 01:01:12 UTC
[pulsar] branch branch-2.11 updated: Update proxy lookup throw exception type (#17600)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch branch-2.11
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/branch-2.11 by this push:
new 5bcf254b892 Update proxy lookup throw exception type (#17600)
5bcf254b892 is described below
commit 5bcf254b8922d255078a78e834675b7dc39fcc4f
Author: Guangning E <gu...@streamnative.io>
AuthorDate: Wed Sep 14 09:47:28 2022 +0800
Update proxy lookup throw exception type (#17600)
(cherry picked from commit 52a380f7e930e633dcefcbdb29ee1460e867dcfe)
---
.../org/apache/pulsar/proxy/server/LookupProxyHandler.java | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
index 1532b5c0f52..472de4327f9 100644
--- a/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
+++ b/pulsar-proxy/src/main/java/org/apache/pulsar/proxy/server/LookupProxyHandler.java
@@ -151,7 +151,7 @@ public class LookupProxyHandler {
if (t != null) {
log.warn("[{}] Failed to lookup topic {}: {}", clientAddress, topic, t.getMessage());
proxyConnection.ctx().writeAndFlush(
- Commands.newLookupErrorResponse(ServerError.ServiceNotReady, t.getMessage(), clientRequestId));
+ Commands.newLookupErrorResponse(getServerError(t), t.getMessage(), clientRequestId));
} else {
String brokerUrl = connectWithTLS ? r.brokerUrlTls : r.brokerUrl;
if (r.redirect) {
@@ -179,7 +179,7 @@ public class LookupProxyHandler {
}).exceptionally(ex -> {
// Failed to connect to backend broker
proxyConnection.ctx().writeAndFlush(
- Commands.newLookupErrorResponse(ServerError.ServiceNotReady, ex.getMessage(), clientRequestId));
+ Commands.newLookupErrorResponse(getServerError(ex), ex.getMessage(), clientRequestId));
return null;
});
}
@@ -249,7 +249,7 @@ public class LookupProxyHandler {
});
}).exceptionally(ex -> {
// Failed to connect to backend broker
- proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(ServerError.ServiceNotReady,
+ proxyConnection.ctx().writeAndFlush(Commands.newPartitionMetadataResponse(getServerError(ex),
ex.getMessage(), clientRequestId));
return null;
});
@@ -330,7 +330,7 @@ public class LookupProxyHandler {
log.warn("[{}] Failed to get TopicsOfNamespace {}: {}",
clientAddress, namespaceName, t.getMessage());
proxyConnection.ctx().writeAndFlush(
- Commands.newError(clientRequestId, ServerError.ServiceNotReady, t.getMessage()));
+ Commands.newError(clientRequestId, getServerError(t), t.getMessage()));
} else {
proxyConnection.ctx().writeAndFlush(
Commands.newGetTopicsOfNamespaceResponse(r.getTopics(), r.getTopicsHash(), r.isFiltered(),
@@ -342,7 +342,7 @@ public class LookupProxyHandler {
}).exceptionally(ex -> {
// Failed to connect to backend broker
proxyConnection.ctx().writeAndFlush(
- Commands.newError(clientRequestId, ServerError.ServiceNotReady, ex.getMessage()));
+ Commands.newError(clientRequestId, getServerError(ex), ex.getMessage()));
return null;
});
}
@@ -385,7 +385,7 @@ public class LookupProxyHandler {
if (t != null) {
log.warn("[{}] Failed to get schema {}: {}", clientAddress, topic, t);
proxyConnection.ctx().writeAndFlush(
- Commands.newError(clientRequestId, ServerError.ServiceNotReady, t.getMessage()));
+ Commands.newError(clientRequestId, getServerError(t), t.getMessage()));
} else {
proxyConnection.ctx().writeAndFlush(
Commands.newGetSchemaResponse(clientRequestId, r));
@@ -396,7 +396,7 @@ public class LookupProxyHandler {
}).exceptionally(ex -> {
// Failed to connect to backend broker
proxyConnection.ctx().writeAndFlush(
- Commands.newError(clientRequestId, ServerError.ServiceNotReady, ex.getMessage()));
+ Commands.newError(clientRequestId, getServerError(ex), ex.getMessage()));
return null;
});