KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, String... topics) { this(consumerFactory, new ContainerProperties(topics)); }
/** * 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; }
/** * Specify an {@link ErrorHandler} for the {@link AbstractMessageListenerContainer}. * @param errorHandler the {@link ErrorHandler}. * @return the spec. * @see ErrorHandler */ public KafkaMessageListenerContainerSpec<K, V> errorHandler(ErrorHandler errorHandler) { this.container.getContainerProperties().setErrorHandler(errorHandler); return this; }
/** * Set the max time to block in the consumer waiting for records. * @param pollTimeout the timeout in ms; default 1000. * @return the spec. * @see ContainerProperties#setPollTimeout(long) */ public KafkaMessageListenerContainerSpec<K, V> pollTimeout(long pollTimeout) { this.container.getContainerProperties().setPollTimeout(pollTimeout); return this; }
/** * Set the user defined {@link ConsumerRebalanceListener} implementation. * @param consumerRebalanceListener the {@link ConsumerRebalanceListener} instance * @return the spec. * @see ContainerProperties#setConsumerRebalanceListener(ConsumerRebalanceListener) */ public KafkaMessageListenerContainerSpec<K, V> consumerRebalanceListener( ConsumerRebalanceListener consumerRebalanceListener) { this.container.getContainerProperties().setConsumerRebalanceListener(consumerRebalanceListener); return this; }
/** * Set the timeout for shutting down the container. This is the maximum amount of * time that the invocation to {@code #stop(Runnable)} will block for, before * returning. * @param shutdownTimeout the shutdown timeout. * @return the spec. * @see ContainerProperties#setShutdownTimeout(long) */ public KafkaMessageListenerContainerSpec<K, V> shutdownTimeout(long shutdownTimeout) { this.container.getContainerProperties().setShutdownTimeout(shutdownTimeout); return this; }
/** * Set the commit callback; by default a simple logging callback is used to log * success at DEBUG level and failures at ERROR level. * @param commitCallback the callback. * @return the spec. * @see ContainerProperties#setCommitCallback(OffsetCommitCallback) */ public KafkaMessageListenerContainerSpec<K, V> commitCallback(OffsetCommitCallback commitCallback) { this.container.getContainerProperties().setCommitCallback(commitCallback); return this; }
/** * When using Kafka group management and {@link #pauseEnabled(boolean)} is * true, set the delay after which the consumer should be paused. Default 10000. * @param pauseAfter the delay. * @return the spec. * @see ContainerProperties#setPauseAfter(long) */ public KafkaMessageListenerContainerSpec<K, V> pauseAfter(long pauseAfter) { this.container.getContainerProperties().setPauseAfter(pauseAfter); return this; }
/** * Set the number of outstanding record count after which offsets should be * committed when {@link AbstractMessageListenerContainer.AckMode#COUNT} * or {@link AbstractMessageListenerContainer.AckMode#COUNT_TIME} is being used. * @param count the count * @return the spec. * @see ContainerProperties#setAckCount(int) */ public KafkaMessageListenerContainerSpec<K, V> ackCount(int count) { this.container.getContainerProperties().setAckCount(count); return this; }
/** * Set the executor for threads that invoke the listener. * @param listenerTaskExecutor the executor * @return the spec. * @see ContainerProperties#setListenerTaskExecutor(AsyncListenableTaskExecutor) */ public KafkaMessageListenerContainerSpec<K, V> listenerTaskExecutor( AsyncListenableTaskExecutor listenerTaskExecutor) { this.container.getContainerProperties().setListenerTaskExecutor(listenerTaskExecutor); return this; }
/** * Set to true to avoid rebalancing when this consumer is slow or throws a * qualifying exception - pause the consumer. Default: true. * @param pauseEnabled true to pause. * @return the spec. * @see #pauseAfter(long) * @see ContainerProperties#setPauseEnabled(boolean) */ public KafkaMessageListenerContainerSpec<K, V> pauseEnabled(boolean pauseEnabled) { this.container.getContainerProperties().setPauseEnabled(pauseEnabled); return this; }
/** * Set the queue depth for handoffs from the consumer thread to the listener * thread. Default 1 (up to 2 in process). * @param queueDepth the queue depth. * @return the spec. * @see ContainerProperties#setQueueDepth(int) */ public KafkaMessageListenerContainerSpec<K, V> queueDepth(int queueDepth) { this.container.getContainerProperties().setQueueDepth(queueDepth); return this; }
KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, TopicPartitionInitialOffset... topicPartitions) { this(consumerFactory, new ContainerProperties(topicPartitions)); }
/** * 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 the user defined {@link ConsumerRebalanceListener} implementation. * @param consumerRebalanceListener the {@link ConsumerRebalanceListener} instance * @return the spec. * @see ContainerProperties#setConsumerRebalanceListener(ConsumerRebalanceListener) */ public KafkaMessageListenerContainerSpec<K, V> consumerRebalanceListener( ConsumerRebalanceListener consumerRebalanceListener) { this.container.getContainerProperties().setConsumerRebalanceListener(consumerRebalanceListener); return this; }
/** * Set the timeout for shutting down the container. This is the maximum amount of * time that the invocation to {@code #stop(Runnable)} will block for, before * returning. * @param shutdownTimeout the shutdown timeout. * @return the spec. * @see ContainerProperties#setShutdownTimeout(long) */ public KafkaMessageListenerContainerSpec<K, V> shutdownTimeout(long shutdownTimeout) { this.container.getContainerProperties().setShutdownTimeout(shutdownTimeout); return this; }
KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, TopicPartitionInitialOffset... topicPartitions) { this(consumerFactory, new ContainerProperties(topicPartitions)); }
KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, Pattern topicPattern) { this(consumerFactory, new ContainerProperties(topicPattern)); }
KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, String... topics) { this(consumerFactory, new ContainerProperties(topics)); }
KafkaMessageListenerContainerSpec(ConsumerFactory<K, V> consumerFactory, Pattern topicPattern) { this(consumerFactory, new ContainerProperties(topicPattern)); }