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

@SendTo does not get converter applied when returning Message<T> [SPR-13124] #17715

Closed
spring-issuemaster opened this issue Jun 14, 2015 · 5 comments

Comments

Projects
None yet
2 participants
@spring-issuemaster
Copy link
Collaborator

commented Jun 14, 2015

Kazuki Shimizu opened SPR-13124 and commented

When return a Message<T> on @JmsListener's method, a specified MessageConverter has not been applied.

The following method is not work.

@JmsListener(destination = "TodoQueue")
@SendTo("ReplyTodoQueue")
public Message<Todo> receive(Message<Todo> message)  {
    Object xTrack = message.getHeaders().get("X-Track");
    Todo todo = message.getPayload();
    todo.setTodoId(UUID.randomUUID().toString());
    return MessageBuilder
            .withPayload(todo)
            .setHeader("X-Track", xTrack)
            .build();
}

The following method is work.

@JmsListener(destination = "TodoQueue")
@SendTo("ReplyTodoQueue")
public Todo receive(Message<Todo> message)  {
    Todo todo = message.getPayload();
    todo.setTodoId(UUID.randomUUID().toString());
    return todo;
}

Affects: 4.1.6

Issue Links:

  • #17511 Allow for marshalling the messaging Message payload with an user defined marshaller

Referenced from: commits spring-projects/spring-framework-issues@1344959, spring-projects/spring-framework-issues@51bdab0

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 14, 2015

Kazuki Shimizu commented

I submitted a PR of report application (spring-projects/spring-framework-issues#99).

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 14, 2015

Kazuki Shimizu commented

Probably, this implementation is one of cause of this issue.
A toMessage method of messagingMessageConverter instance use the SimpleMessageConverter always.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 14, 2015

Juergen Hoeller commented

Stéphane Nicoll, this could possibly be fixed as of 4.2 RC1 through #17511 already?

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 14, 2015

Kazuki Shimizu commented

I was tried 4.2.0.BUILD-SNAPSHOT.
This behavior has been fixed.

Thank you.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

commented Jun 15, 2015

Juergen Hoeller commented

Alright, I'll mark this as resolved for 4.2 RC1 then...

Juergen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.