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

Confusing behaviour of serialization/deserialization of message in consumer_rabbit_middleware module #291

Open
mkrzywanski opened this issue Aug 1, 2021 · 1 comment

Comments

@mkrzywanski
Copy link
Contributor

mkrzywanski commented Aug 1, 2021

Describe the bug
I am not sure if this is a bug but it concerns consumer_rabbit_middleware module. The message that is produced by StubTrigger is serialized twice. Therfore it results in escaped json string that is consumed by listener. In the end we end up with instance of Foo2 that has field foo with value of json ({"foo":"example"}).

image

The actual body is first created in StubRunnerExecutor::send method (JsonOutput.toJson method call). Then the resulting json string is serialized again : here when writing the payload to bytes - we end up with escaped json. The deserialization works since Foo2 has constructor that accepts String.

The solution would be to convert generic payload to bytes without using ObjectMapper (it will be String in this case so simple cast could be sufficient).

If it is not desired behaviour (at least I suspect so) I could create a PR for this.

@marcingrzejszczak
Copy link
Contributor

I don't think this is intended. Please feel free to file a PR against contract 3.0.x branch.

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

No branches or pull requests

2 participants