Java Code Examples for org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory#setBatchListener()
The following examples show how to use
org.springframework.kafka.config.ConcurrentKafkaListenerContainerFactory#setBatchListener() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KafkaConsumerConfiguration.java From ZTuoExchange_framework with MIT License | 6 votes |
@Bean public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.setConcurrency(concurrency); factory.getContainerProperties().setPollTimeout(1500); factory.setBatchListener(true); return factory; }
Example 2
Source File: UmcReceiveAutoConfiguration.java From super-cloudops with Apache License 2.0 | 6 votes |
@Bean(BEAN_KAFKA_BATCH_FACTORY) @EnableKafkaCollectReceiver @SuppressWarnings({ "unchecked", "rawtypes" }) public KafkaListenerContainerFactory<?> batchFactory(ReceiverProperties conf) { // Create consumer factory. Properties properties = conf.getKafka().getProperties(); Map<String, Object> config = (Map) properties; ConsumerFactory<String, String> cf = new DefaultKafkaConsumerFactory<>(config); // Create concurrent consumer container factory. ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(cf); factory.setConcurrency(conf.getKafka().getConcurrency()); factory.setBatchListener(true); // Spring kafka container properties. ContainerProperties containerProps = factory.getContainerProperties(); containerProps.setPollTimeout(conf.getKafka().getPollTimeout()); // Bulk consumption change buffer queue size. containerProps.setQueueDepth(conf.getKafka().getQueueDepth()); containerProps.setAckMode(AckMode.MANUAL_IMMEDIATE); return factory; }
Example 3
Source File: KafkaConsumerConfiguration.java From ZTuoExchange_framework with MIT License | 5 votes |
@Bean public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.setConcurrency(concurrency); factory.getContainerProperties().setPollTimeout(1500); factory.setBatchListener(true); return factory; }
Example 4
Source File: KafkaConsumerConfiguration.java From ZTuoExchange_framework with MIT License | 5 votes |
@Bean public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.setConcurrency(concurrency); factory.getContainerProperties().setPollTimeout(1500); factory.setBatchListener(true); return factory; }
Example 5
Source File: KafkaConsumerConfiguration.java From ZTuoExchange_framework with MIT License | 5 votes |
@Bean public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.setConcurrency(concurrency); factory.getContainerProperties().setPollTimeout(1500); factory.setBatchListener(true); return factory; }
Example 6
Source File: KafkaConsumerConfig.java From kafka-with-springboot with Apache License 2.0 | 5 votes |
@Bean(name = "kafkaListenerContainerFactoryForBatchConsumer") public KafkaListenerContainerFactory<ConcurrentMessageListenerContainer<String, String>> kafkaListenerContainerFactoryForBatchConsumer() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConcurrency(1); factory.setBatchListener(true); factory.setConsumerFactory(consumerFactory()); return factory; }
Example 7
Source File: KafkaConfiguration.java From spring-rdbms-cdc-kafka-elasticsearch with Apache License 2.0 | 5 votes |
@Bean public ConcurrentKafkaListenerContainerFactory<String, DebeziumEvent> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, DebeziumEvent> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.getContainerProperties().setAckMode(MANUAL); factory.setBatchListener(true); return factory; }
Example 8
Source File: KafkaConfig.java From spring-boot-demo with MIT License | 5 votes |
@Bean public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); factory.setConcurrency(KafkaConsts.DEFAULT_PARTITION_NUM); factory.setBatchListener(true); factory.getContainerProperties().setPollTimeout(3000); return factory; }
Example 9
Source File: ReceiverConfig.java From spring-kafka with MIT License | 5 votes |
@Bean public ConcurrentKafkaListenerContainerFactory<String, String> kafkaListenerContainerFactory() { ConcurrentKafkaListenerContainerFactory<String, String> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory()); // enable batch listening factory.setBatchListener(true); return factory; }