spring-projects / spring-projects/spring-boot
RabbitAutoConfiguration does not have properties for channel transacted
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 81.5k
- Forks
- 42.7k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 65
Description
Spring Boot version: 1.5.9.RELEASE
Spring Boot autoconfiguration for RabbitMQ does not have properties to make the channels of the underlying RabbitTemplate transactional. A workaround is needed to enable it anyway. We did this by implementing a custom BeanPostProcessor
private static class RabbitTransactedBeanPostProcessor implements BeanPostProcessor {
/**
* Make RabitTemplate channel transacted because RabbitAutoConfiguration does not allow to set this
*/
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
if (bean instanceof RabbitTemplate) {
RabbitTemplate rabbitTemplate = (RabbitTemplate) bean;
rabbitTemplate.setChannelTransacted(true);
}
return bean;
}
@Override
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
return bean;
}
}
It is of course also possible to override the RabbitTemplate bean definition, but this would require duplication of the property handling logic. Could you add support for making the Rabbit channel transacted in RabbitAutoConfiguration and RabbitProperties?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with RabbitAutoConfiguration and RabbitProperties to trace how RabbitMQ settings reach the auto-configured RabbitTemplate. Add support for configuring transactional channels through those components, then verify that the resulting RabbitTemplate honors the setting and that existing property handling remains intact.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, rabbitmq, spring-boot
- Domain
- backend, distributed-systems
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100