You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@eventmesh.apache.org by "dipankr (via GitHub)" <gi...@apache.org> on 2023/04/13 03:15:25 UTC

[GitHub] [eventmesh] dipankr opened a new pull request, #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

dipankr opened a new pull request, #3712:
URL: https://github.com/apache/eventmesh/pull/3712

   <!--
   ### 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 #3652.
   
   ### Motivation
   
   *there were duplicate code in the file, refactored the duplicate code to a method and refactored further to make the code more readable*
   
   
   ### Modifications
   
   *refactored the code, extracted a new method and used switch to make code more readable*
   
   
   ### Documentation
   
   - Does this pull request introduce a new feature? (no)
   


-- 
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


[GitHub] [eventmesh] xwm1992 merged pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "xwm1992 (via GitHub)" <gi...@apache.org>.
xwm1992 merged PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712


-- 
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


[GitHub] [eventmesh] dipankr commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "dipankr (via GitHub)" <gi...@apache.org>.
dipankr commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165253610


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   can you help with this build error:
   ![image](https://user-images.githubusercontent.com/42119635/231714227-d736c661-e07b-4335-9ef7-2acd167aae9b.png)
   



-- 
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


[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165245891


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   SpecVersion.parse(sendMessageBatchV2RequestHeader.getProtocolVersion())



-- 
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


[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165261602


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   ![image](https://user-images.githubusercontent.com/91315508/231715560-c12b562c-5fb8-4085-b85d-5f4c962f72db.png)
   I am able to build success here.



-- 
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


[GitHub] [eventmesh] dipankr commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "dipankr (via GitHub)" <gi...@apache.org>.
dipankr commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165307289


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   I was finally able to get a green build. The issue was timeout error when downloading jars
   fix:
   added 
   -Dorg.gradle.internal.http.connectionTimeout=120000 -Dorg.gradle.internal.http.socketTimeout=120000
   
   to org.gradle.jvmargs in gradle.properties



-- 
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


[GitHub] [eventmesh] Alonexc commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "Alonexc (via GitHub)" <gi...@apache.org>.
Alonexc commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165261602


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   ![image](https://user-images.githubusercontent.com/91315508/231715560-c12b562c-5fb8-4085-b85d-5f4c962f72db.png)
   I was able to compile successfully here.



-- 
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


[GitHub] [eventmesh] codecov[bot] commented on pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#issuecomment-1514262538

   ## [Codecov](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#3712](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (07efc71) into [master](https://codecov.io/gh/apache/eventmesh/commit/36036dac908e35df76bd2e899cc44bee0be4640a?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (36036da) will **increase** coverage by `0.00%`.
   > The diff coverage is `0.00%`.
   
   > :exclamation: Current head 07efc71 differs from pull request most recent head 3fd8f89. Consider uploading reports for the commit 3fd8f89 to get more accurate results
   
   ```diff
   @@            Coverage Diff            @@
   ##             master    #3712   +/-   ##
   =========================================
     Coverage     13.76%   13.77%           
     Complexity     1291     1291           
   =========================================
     Files           571      571           
     Lines         29239    29190   -49     
     Branches       2884     2869   -15     
   =========================================
   - Hits           4024     4020    -4     
   + Misses        24841    24797   -44     
   + Partials        374      373    -1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...olver/http/SendMessageBatchV2ProtocolResolver.java](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXByb3RvY29sLXBsdWdpbi9ldmVudG1lc2gtcHJvdG9jb2wtbWVzaG1lc3NhZ2Uvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9wcm90b2NvbC9tZXNobWVzc2FnZS9yZXNvbHZlci9odHRwL1NlbmRNZXNzYWdlQmF0Y2hWMlByb3RvY29sUmVzb2x2ZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [.../protocol/http/processor/UnSubscribeProcessor.java](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvaHR0cC9wcm9jZXNzb3IvVW5TdWJzY3JpYmVQcm9jZXNzb3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ime/core/protocol/tcp/client/task/GoodbyeTask.java](https://codecov.io/gh/apache/eventmesh/pull/3712?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-ZXZlbnRtZXNoLXJ1bnRpbWUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL2V2ZW50bWVzaC9ydW50aW1lL2NvcmUvcHJvdG9jb2wvdGNwL2NsaWVudC90YXNrL0dvb2RieWVUYXNrLmphdmE=) | `0.00% <0.00%> (ø)` | |
   
   ... and [7 files with indirect coverage changes](https://codecov.io/gh/apache/eventmesh/pull/3712/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   :mega: We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   


-- 
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


[GitHub] [eventmesh] dipankr commented on a diff in pull request #3712: [ISSUE #3652] refactored the code, extracted a new method and used switch

Posted by "dipankr (via GitHub)" <gi...@apache.org>.
dipankr commented on code in PR #3712:
URL: https://github.com/apache/eventmesh/pull/3712#discussion_r1165272848


##########
eventmesh-protocol-plugin/eventmesh-protocol-meshmessage/src/main/java/org/apache/eventmesh/protocol/meshmessage/resolver/http/SendMessageBatchV2ProtocolResolver.java:
##########
@@ -42,84 +42,50 @@ public static CloudEvent buildEvent(Header header, Body body) throws ProtocolHan
             SendMessageBatchV2RequestHeader sendMessageBatchV2RequestHeader = (SendMessageBatchV2RequestHeader) header;
             SendMessageBatchV2RequestBody sendMessageBatchV2RequestBody = (SendMessageBatchV2RequestBody) body;
 
-            String protocolType = sendMessageBatchV2RequestHeader.getProtocolType();
-            String protocolDesc = sendMessageBatchV2RequestHeader.getProtocolDesc();
-            String protocolVersion = sendMessageBatchV2RequestHeader.getProtocolVersion();
-
-            String code = sendMessageBatchV2RequestHeader.getCode();
-            String env = sendMessageBatchV2RequestHeader.getEnv();
-            String idc = sendMessageBatchV2RequestHeader.getIdc();
-            String ip = sendMessageBatchV2RequestHeader.getIp();
-            String pid = sendMessageBatchV2RequestHeader.getPid();
-            String sys = sendMessageBatchV2RequestHeader.getSys();
-            String username = sendMessageBatchV2RequestHeader.getUsername();
-            String passwd = sendMessageBatchV2RequestHeader.getPasswd();
-            ProtocolVersion version = sendMessageBatchV2RequestHeader.getVersion();
-            String language = sendMessageBatchV2RequestHeader.getLanguage();
-
-            String content = sendMessageBatchV2RequestBody.getMsg();
-
-            CloudEvent event = null;
             CloudEventBuilder cloudEventBuilder;
-            if (StringUtils.equals(SpecVersion.V1.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v1();
-
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
-            } else if (StringUtils.equals(SpecVersion.V03.toString(), protocolVersion)) {
-                cloudEventBuilder = CloudEventBuilder.v03();
-                cloudEventBuilder = cloudEventBuilder.withId(sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withSubject(sendMessageBatchV2RequestBody.getTopic())
-                    .withType("eventmeshmessage")
-                    .withSource(URI.create("/"))
-                    .withData(content.getBytes(StandardCharsets.UTF_8))
-                    .withExtension(ProtocolKey.REQUEST_CODE, code)
-                    .withExtension(ProtocolKey.ClientInstanceKey.ENV, env)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IDC, idc)
-                    .withExtension(ProtocolKey.ClientInstanceKey.IP, ip)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PID, pid)
-                    .withExtension(ProtocolKey.ClientInstanceKey.SYS, sys)
-                    .withExtension(ProtocolKey.ClientInstanceKey.USERNAME, username)
-                    .withExtension(ProtocolKey.ClientInstanceKey.PASSWD, passwd)
-                    .withExtension(ProtocolKey.VERSION, version.getVersion())
-                    .withExtension(ProtocolKey.LANGUAGE, language)
-                    .withExtension(ProtocolKey.PROTOCOL_TYPE, protocolType)
-                    .withExtension(ProtocolKey.PROTOCOL_DESC, protocolDesc)
-                    .withExtension(ProtocolKey.PROTOCOL_VERSION, protocolVersion)
-                    .withExtension(SendMessageBatchV2RequestBody.BIZSEQNO, sendMessageBatchV2RequestBody.getBizSeqNo())
-                    .withExtension(SendMessageBatchV2RequestBody.PRODUCERGROUP, sendMessageBatchV2RequestBody.getProducerGroup())
-                    .withExtension(SendMessageBatchV2RequestBody.TTL, sendMessageBatchV2RequestBody.getTtl());
-                if (StringUtils.isNotEmpty(sendMessageBatchV2RequestBody.getTag())) {
-                    cloudEventBuilder = cloudEventBuilder.withExtension(SendMessageRequestBody.TAG, sendMessageBatchV2RequestBody.getTag());
-                }
-                event = cloudEventBuilder.build();
+            switch (parse(sendMessageBatchV2RequestHeader.getProtocolVersion())) {

Review Comment:
   I haven't had a green build ever in my local. it fails every single time. I doubt it is something to do with the versions. I have set the java to 1.8 in local, can you help me with what else can I do to get it working?



-- 
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