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
JsonType of request overrides response type when using JMS inbound gateway in combination with json converters (jackson2) [INT-3535] #7498
Comments
Artem Bilan commented Share, please, your test-case. Or even better: provide a contribution on the matter! |
Joost van Weenen commented I'll try to come up with an minimal test-case. I don't think that i have the knowledge to patch the problem. |
Joost van Weenen commented Before calling headerMapper.fromHeaders(replyMessage.getHeaders(), jmsReply) @ line ChannelPublishingJmsMessageListener:342
After calling the function which is implemented in my case by concrete class DefaultJmsHeaderMapper:
This triggers the following exception in the receiving outbound gateway:
The exception is caused by the fact that the gateway is receiving a simpel string "This is a String" but the javatype of the message indicates it should be JSON representing an object of type net.vanweenen.spring.bug.MyCustomTypeDTO. Hope this helps. I will upload the example in a couple of hours.
|
Joost van Weenen commented Minimal test case |
Artem Bilan commented Well, I see now what's going on. The real issue is around that This issue isn't related to that with AMQP. Since here Having that all I don't see reason to change anything in the Framework, because we don't have access to the However you can filter it just after Let us know if it is appropriate for you and we close it as won't fix. |
Joost van Weenen commented Ok, I agree about the fact that spring shouldn't/can't access the But then again this also isn't behavior that made sense to me. I expected the
I can confirm that your proposed solution worked for me. Sorry about the complicated example, still learning this stuff ;) |
Artem Bilan commented Well, I sleeped with this one more time :) And now I see that the result of I think I'll PR something soon to show what's going on. Of course it will be only the change to the current version without backport, because there is always a case when end-users may rely on the bug. |
Gary Russell commented Merged. |
Joost van Weenen opened INT-3535 and commented
I believe that the issue described in #7262 still exists for JMS based gateways.
I have a unit test where i post a request message of type java.lang.String and expect another type in the reply.
The headers with the type from the request are copied over the header value that is provided by the json messageconverter.
The problem is located in the function ```
org.springframework.integration.jms.DefaultJmsHeaderMapper.fromHeaders(MessageHeaders headers, javax.jms.Message jmsMessage)
@JsonTypeInfo
(use = JsonTypeInfo.Id.CLASS, include = JsonTypeInfo.As.PROPERTY, property = "jms_javatype")@Component
public class Command {
@JsonProperty
("id")public String id;
@JsonProperty
("amount")public Integer amount;
}
Affects: 4.0.4
Attachments:
Referenced from: pull request #1302
The text was updated successfully, but these errors were encountered: