-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ISSUE #845] support standard json #846
Conversation
Is it possible to change the deserialization workflow as follows?
|
@@ -558,7 +558,8 @@ func (routeData *TopicRouteData) decode(data string) error { | |||
if i < 0 { | |||
continue | |||
} | |||
id, _ := strconv.ParseInt(str[0:i], 10, 64) | |||
brokerId := strings.ReplaceAll(str[0:i], "\"", "") | |||
id, _ := strconv.ParseInt(brokerId, 10, 64) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we deserialize JSON string in a standard way? Make the SDK could handle both the two formats.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am afraid we cant use the standard way because the json is not standard, the change have already handled both stardard hand non-stardard formats
I think it is worthless to Attempt the first time to parse standard json, because in most case it will fail. the manual code is ugly but unfortunately we cant remove it, and its solid. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
according to apache/rocketmq#4471 , i will close this pr first.
@yuz10 I am assuming this pull request works for both standard and illegal JSON responses. Right? |
What is the purpose of the change
#845
because apache/rocketmq#4432 change route info to standard json such as:
{"brokerDatas":[{"brokerAddrs":{"0":"127.0.0.1:10911"}]}
the old is:
{"brokerDatas":[{"brokerAddrs":{0:"127.0.0.1:10911"}]}
Brief changelog
XX
Verifying this change
XXXX
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
.[ISSUE #123] Fix UnknownException when host config not exist
. Each commit in the pull request should have a meaningful subject line and body.