Skip to content
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 #3523] fix json serialization issue when using redis #3524

Merged
merged 5 commits into from
Mar 29, 2023

Conversation

hgaol
Copy link
Contributor

@hgaol hgaol commented Mar 23, 2023

Fixes #3523 .

Motivation

bug fix for redis storage. After this change, the json be serialized successfully and the consumer can consume the data.
image

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

@codecov
Copy link

codecov bot commented Mar 23, 2023

Codecov Report

Merging #3524 (cd8e857) into master (54cd00f) will decrease coverage by 0.01%.
The diff coverage is 25.00%.

❗ Current head cd8e857 differs from pull request most recent head 3330ae7. Consider uploading reports for the commit 3330ae7 to get more accurate results

@@             Coverage Diff              @@
##             master    #3524      +/-   ##
============================================
- Coverage     14.62%   14.62%   -0.01%     
  Complexity     1526     1526              
============================================
  Files           651      651              
  Lines         31711    31716       +5     
  Branches       3033     3033              
============================================
  Hits           4638     4638              
- Misses        26657    26662       +5     
  Partials        416      416              
Impacted Files Coverage Δ
...in/java/org/apache/eventmesh/common/Constants.java 85.71% <ø> (ø)
...ventmesh/common/protocol/tcp/EventMeshMessage.java 0.00% <0.00%> (ø)
...ssage/resolver/tcp/TcpMessageProtocolResolver.java 0.00% <0.00%> (ø)
...me/core/protocol/grpc/service/ConsumerService.java 0.00% <ø> (ø)
...e/core/protocol/grpc/service/HeartbeatService.java 0.00% <ø> (ø)
...me/core/protocol/grpc/service/ProducerService.java 0.00% <ø> (ø)
...ventmesh/storage/rocketmq/admin/RocketMQAdmin.java 0.00% <0.00%> (ø)
...h/storage/rocketmq/admin/RocketMQAdminAdaptor.java 0.00% <0.00%> (ø)
...orage/standalone/admin/StandaloneAdminAdaptor.java 0.00% <0.00%> (ø)
...mesh/storage/standalone/admin/StandaloneAdmin.java 92.30% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

Copy link
Member

@mytang0 mytang0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Please pass through the header, do not write hard.

@hgaol
Copy link
Contributor Author

hgaol commented Mar 24, 2023

image

Please pass through the header, do not write hard.

Hi @mytang0 . Do you mean the Package header? I saw all of current headers are consistent for EventMeshMessage, see screenshot below. Or should I add another headers property with type HashMap in EventMeshMessage, and add all the headers in Package.Header?
pls let me know your preference. Thanks!
image

@mytang0
Copy link
Member

mytang0 commented Mar 27, 2023

image Please pass through the header, do not write hard.

Hi @mytang0 . Do you mean the Package header? I saw all of current headers are consistent for EventMeshMessage, see screenshot below. Or should I add another headers property with type HashMap in EventMeshMessage, and add all the headers in Package.Header? pls let me know your preference. Thanks! image

Hello, that's what i thought

  • By default, dataContentType is 'application/json'. The problem with the test case is that the body is not json. So fixing 'text/plain' directly is problematic.
  • Therefore, to fundamentally solve this problem. The specified dataContentType that non-json needs to display when the producer publishes a message, and then pass the dataContentType on.
  • You are right to think about it. We can be simple first, directly in the header.properties

@hgaol
Copy link
Contributor Author

hgaol commented Mar 27, 2023

image Please pass through the header, do not write hard.

Hi @mytang0 . Do you mean the Package header? I saw all of current headers are consistent for EventMeshMessage, see screenshot below. Or should I add another headers property with type HashMap in EventMeshMessage, and add all the headers in Package.Header? pls let me know your preference. Thanks! image

Hello, that's what i thought

  • By default, dataContentType is 'application/json'. The problem with the test case is that the body is not json. So fixing 'text/plain' directly is problematic.
  • Therefore, to fundamentally solve this problem. The specified dataContentType that non-json needs to display when the producer publishes a message, and then pass the dataContentType on.
  • You are right to think about it. We can be simple first, directly in the header.properties

updated. pls let me know if any comment. :)

@hgaol
Copy link
Contributor Author

hgaol commented Mar 28, 2023

Hi @mytang0 , any comment?

mytang0

This comment was marked as duplicate.

@hgaol
Copy link
Contributor Author

hgaol commented Mar 28, 2023

don't know why CI still error, I didn't change this class and it's succeeded to build on my local machine...
image

@xwm1992
Copy link
Contributor

xwm1992 commented Mar 28, 2023

don't know why CI still error, I didn't change this class and it's succeeded to build on my local machine... image

you can find this under the HTTPClientHandler , because using try-catch with resource, you can remove the out.write in the catch block with the log.error instead.

@hgaol
Copy link
Contributor Author

hgaol commented Mar 28, 2023

don't know why CI still error, I didn't change this class and it's succeeded to build on my local machine... image

you can find this under the HTTPClientHandler , because using try-catch with resource, you can remove the out.write in the catch block with the log.error instead.

Thank you @xwm1992 , but seems the github action will link this PR branch to another one(maybe the master branch?). Or maybe it will pull master branch and merge the branch for this PR. Because in my branch for the PR, the HTTPClientHandler is different. You can find the code below...

https://github.com/hgaol/incubator-eventmesh/blob/3523/eventmesh-runtime/src/main/java/org/apache/eventmesh/runtime/admin/handler/HTTPClientHandler.java#L98

You can also see the newest CI which is also failed for server go, which I didn't change it... Seems the checkout action will pull the latest master branch and merge current branch, then run these actions.

To keep it simple, I'd like to create another PR to fix the CI issues.

@hgaol
Copy link
Contributor Author

hgaol commented Mar 28, 2023

I've created a new PR for fixing the CI issues, see #3544 .

xwm1992
xwm1992 previously approved these changes Mar 29, 2023
@xwm1992 xwm1992 requested a review from mytang0 March 29, 2023 01:56
mytang0
mytang0 previously approved these changes Mar 29, 2023
Copy link
Member

@mytang0 mytang0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @hgaol Please rebase master to fix CI not pass

@mytang0
Copy link
Member

mytang0 commented Mar 29, 2023

I've created a new PR for fixing the CI issues, see #3544 .

Already merged, please merge into your branch.

@hgaol
Copy link
Contributor Author

hgaol commented Mar 29, 2023

will rebase the newest master, thank you all!

@mytang0 mytang0 merged commit 45825b2 into apache:master Mar 29, 2023
@hgaol hgaol deleted the 3523 branch March 29, 2023 04:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Json serialization issue when using Redis as storage.
4 participants