Skip to content

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

Description

@mkrzywanski

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions