@Bean @ConditionalOnMissingBean(name = "listenerContainerFactory") public RabbitListenerContainerFactory<SimpleMessageListenerContainer> listenerContainerFactory( final SimpleRabbitListenerContainerFactoryConfigurer configurer, final ErrorHandler errorHandler) { final ConfigurableRabbitListenerContainerFactory factory = new ConfigurableRabbitListenerContainerFactory( amqpProperties.isMissingQueuesFatal(), amqpProperties.getDeclarationRetries(), errorHandler); configurer.configure(factory, rabbitConnectionFactory); return factory; }
/** * enables support for @RabbitListener * @param configurer * @return */ @Bean public SimpleRabbitListenerContainerFactory myFactory( SimpleRabbitListenerContainerFactoryConfigurer configurer) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); configurer.configure(factory, connectionFactory); // factory.setMessageConverter(myMessageConverter()); return factory; }
@Bean @ConditionalOnProperty(prefix = "spring.rabbitmq", name = "host") public SimpleRabbitListenerContainerFactory myContainerFactory( SimpleRabbitListenerContainerFactoryConfigurer configurer, ConnectionFactory connectionFactory) { SimpleRabbitListenerContainerFactory factory = new SimpleRabbitListenerContainerFactory(); factory.setPrefetchCount(100); configurer.configure(factory, connectionFactory); return factory; }