Sebastiaan van Erk opened SPR-16036 and commented
I have the following method:
@JmsListener(destination = "myDestination")
public void on(@Payload Object message) { ... }
However messages that are received are not converted (I get AMQTextMessage instances with the XML string in the body). If I change the method signature to:
@JmsListener(destination = "myDestination")
public void on(Message<Object> message) { ... message.getPayload() ... }
then everything works fine (the payload is unmarshalled using the configured JAXB unmarshaller).
Affects: 4.3.7
Comment From: spring-projects-issues
Stéphane Nicoll commented
Can you share a sample that we can run that reproduces the problem?
Comment From: spring-projects-issues
Stéphane Nicoll commented
It's been a month. Can you please provide a sample?
Comment From: spring-projects-issues
Stéphane Nicoll commented
Closing due to lack of feedback.
Comment From: spring-projects-issues
Stephan Seifermann commented
I think the problematic piece of code is located in PayloadArgumentResolver (line 128-131): https://github.com/spring-projects/spring-framework/blob/8874427cf467d6c3e79630bc58ec0200333a459b/spring-messaging/src/main/java/org/springframework/messaging/handler/annotation/support/PayloadArgumentResolver.java#L130
There is no conversion if the type of the payload already matches the type of the payload parameter in the listener signature. If the parameter is object, this holds true.
Are there any points against just removing that check? The only reason I can imagine is performance but this should not degrade correctness in my opinion. I can submit a pull request, if you would like me to.
Comment From: snicoll
Unfortunately, I can't reproduce this. PayloadArgumentResolver
will not attempt to convert the payload if the type is assignable, but it will return the payload, not the JMS message. If you can reproduce this with a supported version, please attach a small sample we can run ourselves and we can reopen.