You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@eventmesh.apache.org by ch...@apache.org on 2022/10/03 11:29:28 UTC
[incubator-eventmesh] branch master updated: [ISSUE #1150] replace strings with constants in ServiceUtils.java
This is an automated email from the ASF dual-hosted git repository.
chenguangsheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 275a35f4 [ISSUE #1150] replace strings with constants in ServiceUtils.java
new 9e0c1605 Merge pull request #1491 from iamkarthikselvaraj/fix-1150
275a35f4 is described below
commit 275a35f493cdca573f6220180dbd7e8e2f71b128
Author: karthik <ka...@gmail.com>
AuthorDate: Mon Oct 3 15:53:09 2022 +0530
[ISSUE #1150] replace strings with constants in ServiceUtils.java
---
.../eventmesh/runtime/constants/EventMeshConstants.java | 3 +++
.../runtime/core/protocol/grpc/service/ServiceUtils.java | 11 ++++++-----
2 files changed, 9 insertions(+), 5 deletions(-)
diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/constants/EventMeshConstants.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/constants/EventMeshConstants.java
index dd9ea0fc..f2a2e05e 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/constants/EventMeshConstants.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/constants/EventMeshConstants.java
@@ -136,4 +136,7 @@ public class EventMeshConstants {
public static final String EVENT_MESH_IDC = "eventMeshIDC";
public static final String IS_BROADCAST = "isBroadcast";
+ public static final String RESP_CODE = "respCode";
+ public static final String RESP_MSG = "respMsg";
+ public static final String BLANK_SPACE = " ";
}
diff --git a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java
index 163e8ecc..51ac905e 100644
--- a/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java
+++ b/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java
@@ -26,6 +26,7 @@ import org.apache.eventmesh.common.protocol.grpc.protos.Response;
import org.apache.eventmesh.common.protocol.grpc.protos.SimpleMessage;
import org.apache.eventmesh.common.protocol.grpc.protos.Subscription;
import org.apache.eventmesh.common.utils.JsonUtils;
+import org.apache.eventmesh.runtime.constants.EventMeshConstants;
import org.apache.eventmesh.runtime.core.protocol.grpc.consumer.consumergroup.GrpcType;
import org.apache.commons.collections4.CollectionUtils;
@@ -118,7 +119,7 @@ public class ServiceUtils {
public static void sendRespAndDone(StatusCode code, String message, EventEmitter<Response> emitter) {
Response response = Response.newBuilder()
.setRespCode(code.getRetCode())
- .setRespMsg(code.getErrMsg() + " " + message)
+ .setRespMsg(code.getErrMsg() + EventMeshConstants.BLANK_SPACE + message)
.setRespTime(String.valueOf(System.currentTimeMillis()))
.build();
emitter.onNext(response);
@@ -127,8 +128,8 @@ public class ServiceUtils {
public static void sendStreamResp(RequestHeader header, StatusCode code, String message, EventEmitter<SimpleMessage> emitter) {
Map<String, String> resp = new HashMap<>();
- resp.put("respCode", code.getRetCode());
- resp.put("respMsg", code.getErrMsg() + " " + message);
+ resp.put(EventMeshConstants.RESP_CODE, code.getRetCode());
+ resp.put(EventMeshConstants.RESP_MSG, code.getErrMsg() + EventMeshConstants.BLANK_SPACE + message);
SimpleMessage simpleMessage = SimpleMessage.newBuilder()
.setHeader(header)
@@ -145,8 +146,8 @@ public class ServiceUtils {
public static void sendStreamRespAndDone(RequestHeader header, StatusCode code, EventEmitter<SimpleMessage> emitter) {
Map<String, String> resp = new HashMap<>();
- resp.put("respCode", code.getRetCode());
- resp.put("respMsg", code.getErrMsg());
+ resp.put(EventMeshConstants.RESP_CODE, code.getRetCode());
+ resp.put(EventMeshConstants.RESP_MSG, code.getErrMsg());
SimpleMessage simpleMessage = SimpleMessage.newBuilder()
.setHeader(header)
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: commits-help@eventmesh.apache.org