Search in sources :

Example 1 with StreamRabbitListenerContainerFactory

use of org.springframework.rabbit.stream.config.StreamRabbitListenerContainerFactory in project spring-boot by spring-projects.

the class RabbitStreamConfiguration method streamRabbitListenerContainerFactory.

@Bean(name = "rabbitListenerContainerFactory")
@ConditionalOnMissingBean(name = "rabbitListenerContainerFactory")
StreamRabbitListenerContainerFactory streamRabbitListenerContainerFactory(Environment rabbitStreamEnvironment, RabbitProperties properties, ObjectProvider<ConsumerCustomizer> consumerCustomizer, ObjectProvider<ContainerCustomizer<StreamListenerContainer>> containerCustomizer) {
    StreamRabbitListenerContainerFactory factory = new StreamRabbitListenerContainerFactory(rabbitStreamEnvironment);
    factory.setNativeListener(properties.getListener().getStream().isNativeListener());
    consumerCustomizer.ifUnique(factory::setConsumerCustomizer);
    containerCustomizer.ifUnique(factory::setContainerCustomizer);
    return factory;
}
Also used : StreamRabbitListenerContainerFactory(org.springframework.rabbit.stream.config.StreamRabbitListenerContainerFactory) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1 Bean (org.springframework.context.annotation.Bean)1 StreamRabbitListenerContainerFactory (org.springframework.rabbit.stream.config.StreamRabbitListenerContainerFactory)1