Pil0tXia commented on code in PR #4337:
URL: https://github.com/apache/eventmesh/pull/4337#discussion_r1285170025
##########
eventmesh-common/src/main/java/org/apache/eventmesh/common/protocol/grpc/common/EventMeshCloudEventUtils.java:
##########
@@ -47,8 +47,12 @@ public static String getEnv(CloudEvent cloudEvent) {
}
public static String getEnv(CloudEvent cloudEvent, String defaultValue) {
+ return getValue(cloudEvent, defaultValue, ProtocolKey.ENV);
+ }
+
+ private static String getValue(CloudEvent cloudEvent, String defaultValue,
String protocolKey) {
try {
- return
cloudEvent.getAttributesOrThrow(ProtocolKey.ENV).getCeString();
+ return cloudEvent.getAttributesOrThrow(protocolKey).getCeString();
} catch (Exception e) {
return defaultValue;
}
Review Comment:
Maybe it would be better to put the utility method at the top or bottom of
the method calls.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]