-
Notifications
You must be signed in to change notification settings - Fork 41.3k
Add auto-configuration for RabbitStreamTemplate #28060
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
Add auto-configuration for RabbitStreamTemplate #28060
Conversation
`RabbitStreamTemplate` is provided at spring-amqp 2.4.
paging @garyrussell for a review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the PR. I don't know this feature but I've added a few observations.
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnClass(RabbitStreamTemplate.class) | ||
@ConditionalOnMissingBean(RabbitStreamTemplate.class) | ||
@ConditionalOnProperty(prefix = "spring.rabbitmq.listener", name = "type", havingValue = "stream") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure I got that. Isn't the listener unrelated to the creation of the template? The latter is for programmatic access, isn't it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - using a stream producer is independent of whether listeners are also stream, by default.
Also, for consistency, this should be moved to RabbitStreamConfiguration
(which will need some rework because the whole class is excluded via this property - move the condition from the class to the factory @Bean
.
The Environment
@Bean
is needed for both producers and consumers.
...igure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
Outdated
Show resolved
Hide resolved
...utoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay - I was on PTO.
@Configuration(proxyBeanMethods = false) | ||
@ConditionalOnClass(RabbitStreamTemplate.class) | ||
@ConditionalOnMissingBean(RabbitStreamTemplate.class) | ||
@ConditionalOnProperty(prefix = "spring.rabbitmq.listener", name = "type", havingValue = "stream") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - using a stream producer is independent of whether listeners are also stream, by default.
Also, for consistency, this should be moved to RabbitStreamConfiguration
(which will need some rework because the whole class is excluded via this property - move the condition from the class to the factory @Bean
.
The Environment
@Bean
is needed for both producers and consumers.
...igure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitAutoConfiguration.java
Outdated
Show resolved
Hide resolved
...utoconfigure/src/main/java/org/springframework/boot/autoconfigure/amqp/RabbitProperties.java
Show resolved
Hide resolved
@eddumelendez would you have time to review the PR? |
@snicoll I will work on the changes next week |
@eddumelendez would you have time to look at the other comments in the review? I am not sure they were all addressed. If you don't, just let us know and we can take over. Thanks! |
@snicoll I will be updating the PR in the next couple of days. sorry for the delay. |
No worries, it is flagged for |
1ca278f
to
902dd0b
Compare
Thanks again @eddumelendez |
RabbitStreamTemplate
is provided at spring-amqp 2.4.