You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@rocketmq.apache.org by GitBox <gi...@apache.org> on 2021/11/20 13:52:51 UTC

[GitHub] [rocketmq] fangzhiheng opened a new pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

fangzhiheng opened a new pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514


   **Make sure set the target branch to `develop`**
   
   ## What is the purpose of the change
   
   由于RemotingSerializable's 的一些子类有类似于 Map<Object, Object> 这样的属性,它们由fastjson序列化后,其JSON的key也是一个object,而这个大多数语言的JSON库无法支持反序列化(比如JS、Golang),因此在开发客户端的时候会造成额外的工作量,故增加SerializerFeature#WriteNonStringKeyAsString的序列化特性,以支持其他语言客户端开发。
   
   ## Brief changelog
   
   ```java
   // org.apache.rocketmq.remoting.protocol.RemotingSerializable:
   public static String toJson(final Object obj, boolean prettyFormat) {
       return JSON.toJSONString(obj, JSON.DEFAULT_GENERATE_FEATURE |
           SerializerFeature.WriteNonStringKeyAsString.mask |
           (prettyFormat ? SerializerFeature.PrettyFormat.mask : 0));
   }
   ```
   
   ## Verifying this change
   
   ```java
   // org.apache.rocketmq.remoting.protocol.RemotingSerializableTest
   @Test
   public void testMapSample() {
       Map<Sample, Sample> map = new HashMap<>();
       Sample sample = new Sample();
       map.put(sample, sample);
       MapSample ms = new MapSample();
       ms.setMapping(map);
   
       String json = RemotingSerializable.toJson(ms, false);
       MapSample decoded = RemotingSerializable.decode(json.getBytes(), MapSample.class);
       assertThat(decoded).isEqualTo(ms);
       assertThat(decoded.getMapping()).isEqualTo(ms.getMapping());
   }
   ```
   
   Follow this checklist to help us incorporate your contribution quickly and easily. Notice, `it would be helpful if you could finish the following 5 checklist(the last one is not necessary)before request the community to review your PR`.
   
   - [x] Make sure there is a [Github issue](https://github.com/apache/rocketmq/issues) filed for the change (usually before you start working on it). Trivial changes like typos do not require a Github issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue. 
   - [x] Format the pull request title like `[ISSUE #123] Fix UnknownException when host config not exist`. Each commit in the pull request should have a meaningful subject line and body.
   - [x] Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
   - [x] Write necessary unit-test(over 80% coverage) to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add integration-test in [test module](https://github.com/apache/rocketmq/tree/master/test).
   - [x] Run `mvn -B clean apache-rat:check findbugs:findbugs checkstyle:checkstyle` to make sure basic checks pass. Run `mvn clean install -DskipITs` to make sure unit-test pass. Run `mvn clean test-compile failsafe:integration-test`  to make sure integration-test pass.
   - [ ] If this contribution is large, please file an [Apache Individual Contributor License Agreement](http://www.apache.org/licenses/#clas).
   


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yuz10 closed pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
yuz10 closed pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514


   


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yuz10 commented on pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
yuz10 commented on pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514#issuecomment-991407704


   I will close the issue for duplication with #3369 ( #3386 )


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] codecov-commenter commented on pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514#issuecomment-979491855


   # [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3514?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 [#3514](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d9e8171) into [develop](https://codecov.io/gh/apache/rocketmq/commit/5e99cdbeb7d56a46059ca83923a12b9a0d80cece?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (5e99cdb) will **increase** coverage by `0.75%`.
   > The diff coverage is `100.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/rocketmq/pull/3514/graphs/tree.svg?width=650&height=150&src=pr&token=4w0sxP1wZv&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@              Coverage Diff              @@
   ##             develop    #3514      +/-   ##
   =============================================
   + Coverage      47.98%   48.74%   +0.75%     
   - Complexity      4567     4645      +78     
   =============================================
     Files            552      555       +3     
     Lines          36628    36731     +103     
     Branches        4844     4837       -7     
   =============================================
   + Hits           17577    17904     +327     
   + Misses         16831    16582     -249     
   - Partials        2220     2245      +25     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...cketmq/remoting/protocol/RemotingSerializable.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL3Byb3RvY29sL1JlbW90aW5nU2VyaWFsaXphYmxlLmphdmE=) | `71.42% <100.00%> (+8.92%)` | :arrow_up: |
   | [.../broker/subscription/SubscriptionGroupManager.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvc3Vic2NyaXB0aW9uL1N1YnNjcmlwdGlvbkdyb3VwTWFuYWdlci5qYXZh) | `54.11% <0.00%> (-16.48%)` | :arrow_down: |
   | [...org/apache/rocketmq/common/stats/StatsItemSet.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9jb21tb24vc3RhdHMvU3RhdHNJdGVtU2V0LmphdmE=) | `41.79% <0.00%> (-10.45%)` | :arrow_down: |
   | [...rocketmq/broker/pagecache/ManyMessageTransfer.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcGFnZWNhY2hlL01hbnlNZXNzYWdlVHJhbnNmZXIuamF2YQ==) | `36.36% <0.00%> (-9.80%)` | :arrow_down: |
   | [.../rocketmq/broker/pagecache/OneMessageTransfer.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-YnJva2VyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9yb2NrZXRtcS9icm9rZXIvcGFnZWNhY2hlL09uZU1lc3NhZ2VUcmFuc2Zlci5qYXZh) | `24.00% <0.00%> (-9.34%)` | :arrow_down: |
   | [...tmq/logappender/log4j2/RocketmqLog4j2Appender.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-bG9nYXBwZW5kZXIvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL2xvZ2FwcGVuZGVyL2xvZzRqMi9Sb2NrZXRtcUxvZzRqMkFwcGVuZGVyLmphdmE=) | `36.66% <0.00%> (-8.34%)` | :arrow_down: |
   | [...va/org/apache/rocketmq/store/GetMessageResult.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL0dldE1lc3NhZ2VSZXN1bHQuamF2YQ==) | `71.73% <0.00%> (-6.84%)` | :arrow_down: |
   | [...in/java/org/apache/rocketmq/test/util/MQAdmin.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-dGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvcm9ja2V0bXEvdGVzdC91dGlsL01RQWRtaW4uamF2YQ==) | `38.88% <0.00%> (-5.56%)` | :arrow_down: |
   | [...org/apache/rocketmq/store/ha/WaitNotifyObject.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c3RvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3N0b3JlL2hhL1dhaXROb3RpZnlPYmplY3QuamF2YQ==) | `66.07% <0.00%> (-5.09%)` | :arrow_down: |
   | [...apache/rocketmq/remoting/netty/ResponseFuture.java](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-cmVtb3Rpbmcvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3JvY2tldG1xL3JlbW90aW5nL25ldHR5L1Jlc3BvbnNlRnV0dXJlLmphdmE=) | `85.00% <0.00%> (-5.00%)` | :arrow_down: |
   | ... and [77 more](https://codecov.io/gh/apache/rocketmq/pull/3514/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [5e99cdb...d9e8171](https://codecov.io/gh/apache/rocketmq/pull/3514?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?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: dev-unsubscribe@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] coveralls commented on pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
coveralls commented on pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514#issuecomment-979491623


   
   [![Coverage Status](https://coveralls.io/builds/44552471/badge)](https://coveralls.io/builds/44552471)
   
   Coverage increased (+0.07%) to 55.187% when pulling **d9e8171566076e31046aeaef5293441d1498c8ef on fangzhiheng:develop** into **4bb99e656b1acc99d3a953f84ae0abcb74737af5 on apache:develop**.
   


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yuz10 closed pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
yuz10 closed pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514


   


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



[GitHub] [rocketmq] yuz10 commented on pull request #3514: 增加SerializerFeature#WriteNonStringKeyAsString 序列化特性以支持其他语言客户端开发

Posted by GitBox <gi...@apache.org>.
yuz10 commented on pull request #3514:
URL: https://github.com/apache/rocketmq/pull/3514#issuecomment-991407704


   I will close the issue for duplication with #3369 ( #3386 )


-- 
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@rocketmq.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org