-
Notifications
You must be signed in to change notification settings - Fork 41.2k
Auto-configure a MessageConverter for Rabbit if one exists in the context #5088
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
Comments
I'm not keen on using a property to configure a If you want to create a @Bean
public RabbitTemplate rabbitTemplate(ConnectionFactory connectionFactory) {
RabbitTemplate template = new RabbitTemplate(connectionFactory);
template.setMessageConverter(…);
return template;
} It's not so easy to configure a converter on the listener container as creating it isn't as straightforward. You could post-process the |
There is the same request for the JMS support and I was waiting for How does that sound? |
See #4284 |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
I'll take that as a yes. I don't like the idea of providing a configuration entry for that anyway. |
@snicoll when you say a |
Yes. I don't really see what you mean by workaround though. |
I was alluding towards the difference between configuring with a property vs creating a |
In that case, I think configuring via a property is a bad idea (programming by properties). Note that as of |
When you say configuring/programming via property is a bad idea, are you referring to this particular case or is that your take in general? Thanks for pointing out While configuring my own |
Let's not start a chat here please, there's gitter for that. The check on name is on purpose as we are configuring the default factory and that's how the implementation looks it up . |
If a `MessageConverter` bean is available, we now associate it to the created `RabbitTemplate` and `RabbitListenerContainerFactory`. That way, registering a custom `MessageConverter` is all that's needed. The Rabbit auto-configuration is now using the new `ObjectProvider` that offers a nicer API to detect if a primary candidate is available for optional collaborators. Closes spring-projectsgh-5088
Hey there,
This is a feature request. Could you please add a property i.e.,
spring.rabbitmq.message-converter
and use it to set message converter on rabbit template and listener when auto configuring them. Thank youThe text was updated successfully, but these errors were encountered: