/** * Set whether the container should ack messages that throw exceptions or not. * @param ackOnError whether the container should acknowledge messages that throw * exceptions. * @return the spec. * @see ContainerProperties#setAckOnError(boolean) */ public KafkaMessageListenerContainerSpec<K, V> ackOnError(boolean ackOnError) { this.container.getContainerProperties().setAckOnError(ackOnError); return this; }
/** * Set whether the container should ack messages that throw exceptions or not. * @param ackOnError whether the container should acknowledge messages that throw * exceptions. * @return the spec. * @see ContainerProperties#setAckOnError(boolean) */ public KafkaMessageListenerContainerSpec<K, V> ackOnError(boolean ackOnError) { this.container.getContainerProperties().setAckOnError(ackOnError); return this; }
messageListenerContainer.getContainerProperties() .setAckMode(AbstractMessageListenerContainer.AckMode.MANUAL); messageListenerContainer.getContainerProperties().setAckOnError(false); .setAckOnError(isAutoCommitOnError(extendedConsumerProperties));
@Bean("operationsKafkaListenerContainerFactory") public ConcurrentKafkaListenerContainerFactory<String, Operation> operationsKafkaListenerContainerFactory( ConsumerFactory<String, Operation> consumerFactory, PlatformTransactionManager platformTransactionManager) { ConcurrentKafkaListenerContainerFactory<String, Operation> factory = new ConcurrentKafkaListenerContainerFactory<>(); factory.setConsumerFactory(consumerFactory); RetryTemplate retryTemplate = new RetryTemplate(); factory.setRetryTemplate(retryTemplate); factory.setConcurrency(eventApisConfiguration.getEventBus().getConsumer().getOperationSchedulerPoolSize()); ThreadPoolTaskScheduler scheduler = new ThreadPoolTaskScheduler(); scheduler.setPoolSize(eventApisConfiguration.getEventBus().getConsumer().getOperationSchedulerPoolSize()); scheduler.setBeanName("OperationsFactory-Scheduler"); scheduler.initialize(); factory.getContainerProperties().setScheduler(scheduler); ThreadPoolTaskScheduler consumerScheduler = new ThreadPoolTaskScheduler(); consumerScheduler.setPoolSize(eventApisConfiguration.getEventBus().getConsumer().getOperationSchedulerPoolSize()); consumerScheduler.setBeanName("OperationsFactory-ConsumerScheduler"); consumerScheduler.initialize(); factory.getContainerProperties().setPollTimeout(3000L); factory.getContainerProperties().setAckOnError(false); factory.getContainerProperties().setConsumerTaskExecutor(consumerScheduler); factory.getContainerProperties().setAckMode(AbstractMessageListenerContainer.AckMode.RECORD); factory.getContainerProperties().setTransactionManager(platformTransactionManager); return factory; }