You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "mxsm (via GitHub)" <gi...@apache.org> on 2023/12/08 15:32:10 UTC
[PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
mxsm opened a new pull request, #4632:
URL: https://github.com/apache/eventmesh/pull/4632
<!--
### Contribution Checklist
- Name the pull request in the form "[ISSUE #XXXX] Title of the pull request",
where *XXXX* should be replaced by the actual issue number.
Skip *[ISSUE #XXXX]* if there is no associated github issue for this pull request.
- Fill out the template below to describe the changes contributed by the pull request.
That will give reviewers the context they need to do the review.
- Each pull request should address only one issue.
Please do not mix up code from multiple issues.
- Each commit in the pull request should have a meaningful commit message.
- Once all items of the checklist are addressed, remove the above text and this checklist,
leaving only the filled out template below.
(The sections below can be removed for hotfixes of typos)
-->
<!--
(If this PR fixes a GitHub issue, please add `Fixes #<XXX>` or `Closes #<XXX>`.)
-->
Fixes #4631
### Motivation
*Explain the content here.*
*Explain why you want to make the changes and what problem you're trying to solve.*
- Optimize the message body of the Java SDK's returned reply message
### Modifications
*Describe the modifications you've done.*
### Documentation
- Does this pull request introduce a new feature? (yes / no)
- If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
- If a feature is not applicable for documentation, explain why?
- If a feature is not documented yet in this PR, please create a followup issue for adding the documentation
--
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: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 merged PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632
--
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: dev-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: dev-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#discussion_r1421386965
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
Doesn't `newBuilder(cloudEvent)` automatically merge the attributes (i.e., `cloudEventMap`) of `cloudEvent` here? Additionally, is `prop` object redundant now?
`newBuilder(cloudEvent)`这一步不是会自动合并`cloudEvent`的attributes(即`cloudEventMap`)吗?另外`prop`对象现在是不是多余的?
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
Doesn't `newBuilder(cloudEvent)` automatically merge the attributes (i.e., `cloudEventMap`) of `cloudEvent` here? Additionally, is `prop` object redundant now?
`newBuilder(cloudEvent)`这一步不是会自动合并`cloudEvent`的attributes(即`cloudEventMap`)吗?另外`prop`对象现在是不是多余的?
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#issuecomment-1847428095
## [Codecov](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
Attention: `4 lines` in your changes are missing coverage. Please review.
> Comparison is base [(`ee9ee4c`)](https://app.codecov.io/gh/apache/eventmesh/commit/ee9ee4c63670b57b832898624a061335153bb67c?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 16.93% compared to head [(`9c8acf3`)](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) 16.93%.
| [Files](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
|---|---|---|
| [...entmesh/client/grpc/consumer/SubStreamHandler.java](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLXNka3MvZXZlbnRtZXNoLXNkay1qYXZhL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9ldmVudG1lc2gvY2xpZW50L2dycGMvY29uc3VtZXIvU3ViU3RyZWFtSGFuZGxlci5qYXZh) | 0.00% | [3 Missing :warning: ](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
| [...me/core/protocol/grpc/service/ConsumerService.java](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvZ3JwYy9zZXJ2aWNlL0NvbnN1bWVyU2VydmljZS5qYXZh) | 0.00% | [1 Missing :warning: ](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #4632 +/- ##
============================================
- Coverage 16.93% 16.93% -0.01%
+ Complexity 1708 1707 -1
============================================
Files 790 789 -1
Lines 29526 29498 -28
Branches 2550 2548 -2
============================================
- Hits 5001 4995 -6
+ Misses 24061 24036 -25
- Partials 464 467 +3
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/eventmesh/pull/4632?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#discussion_r1421395460
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
> Doesn't `newBuilder(cloudEvent)` automatically merge the attributes (i.e., `cloudEventMap`) of `cloudEvent` here? Additionally, is `prop` object redundant now?
>
> `newBuilder(cloudEvent)`这一步不是会自动合并`cloudEvent`的attributes(即`cloudEventMap`)吗?另外`prop`对象现在是不是多余的?
@pandaapo Here, it is guaranteed that if there are identical properties between the returned message and the consumed message, the properties of the consumed message will be used. At the same time, I compared the version before optimization. It is also a similar operation. If the properties do not need to be overwritten, this step is not required. I keep it consistent with the version before GRPC optimization.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#discussion_r1421422450
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
> > if there are identical properties between the returned message and the consumed message, the properties of the consumed message will be used.
>
> OK. Then what is role of `prop`?
@pandaapo I have removed it. my fault .
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "pandaapo (via GitHub)" <gi...@apache.org>.
pandaapo commented on code in PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#discussion_r1421400639
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
> if there are identical properties between the returned message and the consumed message, the properties of the consumed message will be used.
OK. Then what is role of `prop`?
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org
Re: [PR] [ISSUE #4631]Optimize the message body of the Java SDK's returned reply message (eventmesh)
Posted by "mxsm (via GitHub)" <gi...@apache.org>.
mxsm commented on code in PR #4632:
URL: https://github.com/apache/eventmesh/pull/4632#discussion_r1421395460
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
> Doesn't `newBuilder(cloudEvent)` automatically merge the attributes (i.e., `cloudEventMap`) of `cloudEvent` here? Additionally, is `prop` object redundant now?
>
> `newBuilder(cloudEvent)`这一步不是会自动合并`cloudEvent`的attributes(即`cloudEventMap`)吗?另外`prop`对象现在是不是多余的?
Here, it is guaranteed that if there are identical properties between the returned message and the consumed message, the properties of the consumed message will be used. At the same time, I compared the version before optimization. It is also a similar operation. If the properties do not need to be overwritten, this step is not required. I keep it consistent with the version before GRPC optimization.
##########
eventmesh-sdks/eventmesh-sdk-java/src/main/java/org/apache/eventmesh/client/grpc/consumer/SubStreamHandler.java:
##########
@@ -118,26 +116,19 @@ public void onCompleted() {
private CloudEvent buildReplyMessage(final CloudEvent reqMessage, final T replyMessage) {
final CloudEvent cloudEvent = EventMeshCloudEventBuilder.buildEventMeshCloudEvent(replyMessage,
clientConfig, listener.getProtocolType());
- SubscriptionReply subscriptionReply = SubscriptionReply.builder().producerGroup(clientConfig.getConsumerGroup())
- .topic(EventMeshCloudEventUtils.getSubject(cloudEvent))
- .content(EventMeshCloudEventUtils.getDataContent(cloudEvent))
- .seqNum(EventMeshCloudEventUtils.getSeqNum(cloudEvent))
- .uniqueId(EventMeshCloudEventUtils.getUniqueId(cloudEvent))
- .ttl(EventMeshCloudEventUtils.getTtl(cloudEvent)).build();
Map<String, String> prop = new HashMap<>();
Map<String, CloudEventAttributeValue> reqMessageMap = reqMessage.getAttributesMap();
reqMessageMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
Map<String, CloudEventAttributeValue> cloudEventMap = cloudEvent.getAttributesMap();
cloudEventMap.entrySet().forEach(entry -> prop.put(entry.getKey(), entry.getValue().getCeString()));
- subscriptionReply.putAllProperties(prop);
- return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap)
+ return CloudEvent.newBuilder(cloudEvent).putAllAttributes(reqMessageMap).putAllAttributes(cloudEventMap)
Review Comment:
> Doesn't `newBuilder(cloudEvent)` automatically merge the attributes (i.e., `cloudEventMap`) of `cloudEvent` here? Additionally, is `prop` object redundant now?
>
> `newBuilder(cloudEvent)`这一步不是会自动合并`cloudEvent`的attributes(即`cloudEventMap`)吗?另外`prop`对象现在是不是多余的?
Here, it is guaranteed that if there are identical properties between the returned message and the consumed message, the properties of the consumed message will be used. At the same time, I compared the version before optimization. It is also a similar operation. If the properties do not need to be overwritten, this step is not required. I keep it consistent with the version before GRPC optimization.
--
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: issues-unsubscribe@eventmesh.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@eventmesh.apache.org
For additional commands, e-mail: issues-help@eventmesh.apache.org