This is an automated email from the ASF dual-hosted git repository.
lrhkobe pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/eventmesh.git
The following commit(s) were added to refs/heads/master by this push:
new 67b7a9fd5 [ISSUE #4623]Fix cloudEvents variable names do not support
underscores (#4624)
67b7a9fd5 is described below
commit 67b7a9fd51837369e35e976db94a9580af5ddaaf
Author: mxsm <[email protected]>
AuthorDate: Fri Dec 8 11:13:47 2023 +0800
[ISSUE #4623]Fix cloudEvents variable names do not support underscores
(#4624)
---
.../apache/eventmesh/common/protocol/grpc/common/ProtocolKey.java | 4 ++--
.../eventmesh/runtime/core/protocol/grpc/service/ServiceUtils.java | 6 ++++--
.../java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java | 1 -
3 files changed, 6 insertions(+), 5 deletions(-)
diff --git
a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/ProtocolKey.java
b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/ProtocolKey.java
index b4d48c9b7..0aede5644 100644
---
a/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/ProtocolKey.java
+++
b/eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/ProtocolKey.java
@@ -43,8 +43,8 @@ public class ProtocolKey {
public static final String CLIENT_TYPE = "clienttype";
- public static final String GRPC_RESPONSE_CODE = "status_code";
- public static final String GRPC_RESPONSE_MESSAGE = "response_message";
+ public static final String GRPC_RESPONSE_CODE = "statuscode";
+ public static final String GRPC_RESPONSE_MESSAGE = "responsemessage";
public static final String GRPC_RESPONSE_TIME = "time";
public static final String SUB_MESSAGE_TYPE = "submessagetype";
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 0740c5243..bb4a56193 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
@@ -44,6 +44,8 @@ import java.time.ZoneOffset;
import java.util.List;
import java.util.Objects;
+import io.cloudevents.SpecVersion;
+
import com.fasterxml.jackson.core.type.TypeReference;
import com.google.protobuf.Any;
import com.google.protobuf.ByteString;
@@ -163,7 +165,7 @@ public class ServiceUtils {
public static void sendResponseCompleted(StatusCode code, String message,
EventEmitter<CloudEvent> emitter) {
Instant instant = now();
- CloudEvent.Builder builder =
CloudEvent.newBuilder().setId(RandomStringUtils.generateUUID())
+ CloudEvent.Builder builder =
CloudEvent.newBuilder().setId(RandomStringUtils.generateUUID()).setSpecVersion(SpecVersion.V1.toString())
.putAttributes(ProtocolKey.GRPC_RESPONSE_CODE,
CloudEventAttributeValue.newBuilder().setCeString(code.getRetCode()).build())
.putAttributes(ProtocolKey.GRPC_RESPONSE_MESSAGE,
CloudEventAttributeValue.newBuilder().setCeString(code.getErrMsg() +
EventMeshConstants.BLANK_SPACE + message).build())
@@ -182,7 +184,7 @@ public class ServiceUtils {
*/
public static void sendResponseCompleted(StatusCode code,
EventEmitter<CloudEvent> emitter) {
Instant instant = now();
- CloudEvent.Builder builder = CloudEvent.newBuilder()
+ CloudEvent.Builder builder =
CloudEvent.newBuilder().setSpecVersion(SpecVersion.V1.toString())
.putAttributes(ProtocolKey.GRPC_RESPONSE_CODE,
CloudEventAttributeValue.newBuilder().setCeString(code.getRetCode()).build())
.putAttributes(ProtocolKey.GRPC_RESPONSE_MESSAGE,
CloudEventAttributeValue.newBuilder().setCeString(code.getErrMsg()).build())
.putAttributes(ProtocolKey.GRPC_RESPONSE_TIME,
CloudEventAttributeValue.newBuilder()
diff --git
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
index 50ac95de4..3ad13946e 100644
---
a/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
+++
b/eventmesh-runtime/src/test/java/org/apache/eventmesh/runtime/demo/BroadCastSubClient.java
@@ -25,7 +25,6 @@ import
org.apache.eventmesh.runtime.client.common.ClientConstants;
import org.apache.eventmesh.runtime.client.common.MessageUtils;
import org.apache.eventmesh.runtime.client.impl.SubClientImpl;
-
import lombok.extern.slf4j.Slf4j;
@Slf4j
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]