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

JmsMessagingTemplate is wrongly configured #10305

Closed
filiphr opened this issue Sep 15, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@filiphr
Copy link
Contributor

commented Sep 15, 2017

The configuration for the JmsMessagingTemplate is wrong (at least in my opinion). For the JmsTemplate you can configure the MessageConverter and it will be used. However, that converter is not passed to the JmsMessagingTemplate, and therefore the default one is used.

Maybe this is an issue for spring-jms, but I think that it should be correctly configured. It is not complicated as well. One only needs to get the message converter that the JmsTemplate has.

I think that this would be the solution in the MessagingTemplateConfiguration:

@Bean
@ConditionalOnMissingBean
@ConditionalOnSingleCandidate(JmsTemplate.class)
public JmsMessagingTemplate jmsMessagingTemplate(JmsTemplate jmsTemplate) {
    JmsMessagingTemplate messasgingTemplate = new JmsMessagingTemplate(jmsTemplate)
    if (jmsTemplate.getMessageConverter() != null) {
        messagingTemplate.setConverter(jmsTemplate.getMessageConverter();
    }
    return messagingTemplate;
}
@filiphr

This comment has been minimized.

Copy link
Contributor Author

commented Sep 15, 2017

Btw. the RabbitMq messaging template is OK as it is correctly done within it :)

@snicoll

This comment has been minimized.

Copy link
Member

commented Sep 15, 2017

That doesn't sound the right place to fix this. Please open a framework issue instead.

@filiphr

This comment has been minimized.

Copy link
Contributor Author

commented Sep 15, 2017

Thanks for the quick response @snicoll, I was not sure where the correct place to do this was. For info (if someone else stumbles on this), I have opened SPR-15965 in the framework

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.