use of org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory in project loc-framework by lord-of-code.
the class LocKafkaAutoConfiguration method kafkaListenerContainerFactory.
@Bean(name = "kafkaListenerContainerFactory")
public ConcurrentKafkaListenerContainerFactory<?, ?> kafkaListenerContainerFactory(ConcurrentKafkaListenerContainerFactoryConfigurer configurer, ConsumerFactory<Object, Object> kafkaConsumerFactory) {
ConcurrentKafkaListenerContainerFactory<Object, Object> factory = new ConcurrentKafkaListenerContainerFactory<>();
ContainerProperties containerProperties = factory.getContainerProperties();
containerProperties.setErrorHandler(new LocKafkaConsumerErrorHandler());
factory.setRecordFilterStrategy(locMessageFilterStrategy());
factory.setMessageConverter(recordMessageConverter());
configurer.configure(factory, kafkaConsumerFactory);
return factory;
}
use of org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory in project eventapis by kloiasoft.
the class EventApisFactory method eventsKafkaListenerContainerFactory.
@Bean({ "eventsKafkaListenerContainerFactory", "kafkaListenerContainerFactory" })
public ConcurrentKafkaListenerContainerFactory<String, PublishedEventWrapper> eventsKafkaListenerContainerFactory(EventMessageConverter eventMessageConverter, ConsumerFactory<String, PublishedEventWrapper> consumerFactory) {
ConcurrentKafkaListenerContainerFactory<String, PublishedEventWrapper> factory = new ConcurrentKafkaListenerContainerFactory<>();
factory.setConsumerFactory(consumerFactory);
factory.setConcurrency(eventApisConfiguration.getEventBus().getConsumer().getEventConcurrency());
factory.setMessageConverter(eventMessageConverter);
factory.getContainerProperties().setPollTimeout(3000);
ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler();
scheduler.setPoolSize(eventApisConfiguration.getEventBus().getConsumer().getEventSchedulerPoolSize());
scheduler.setBeanName("EventsFactory-Scheduler");
scheduler.initialize();
factory.getContainerProperties().setScheduler(scheduler);
factory.getContainerProperties().setAckMode(AbstractMessageListenerContainer.AckMode.RECORD);
return factory;
}
Aggregations