Class MultiNodeKafkaResumeStrategy<K,​V>

  • Type Parameters:
    K - the type of key
    V - the type of the value
    All Implemented Interfaces:
    AutoCloseable, KafkaResumeStrategy<K,​V>, org.apache.camel.resume.ResumeStrategy, org.apache.camel.resume.UpdatableConsumerResumeStrategy<K,​V,​org.apache.camel.resume.Resumable<K,​V>>, org.apache.camel.Service

    public class MultiNodeKafkaResumeStrategy<K,​V>
    extends SingleNodeKafkaResumeStrategy<K,​V>
    A resume strategy that publishes offsets to a Kafka topic. This resume strategy is suitable for multi node integrations. This is suitable, for instance, when using clusters with the master component.
    • Constructor Detail

      • MultiNodeKafkaResumeStrategy

        public MultiNodeKafkaResumeStrategy​(String bootstrapServers,
                                            String topic,
                                            org.apache.camel.resume.cache.ResumeCache<K,​V> resumeCache,
                                            org.apache.camel.resume.ResumeAdapter resumeAdapter)
        Create a new instance of this class
        Parameters:
        bootstrapServers - the address of the Kafka broker
        topic - the topic where to publish the offsets
        resumeCache - a cache instance where to store the offsets locally for faster access
        resumeAdapter - the component-specific resume adapter
      • MultiNodeKafkaResumeStrategy

        public MultiNodeKafkaResumeStrategy​(String bootstrapServers,
                                            String topic,
                                            org.apache.camel.resume.cache.ResumeCache<K,​V> resumeCache,
                                            org.apache.camel.resume.ResumeAdapter resumeAdapter,
                                            ExecutorService executorService)
        Builds an instance of this class
        Parameters:
        bootstrapServers -
        topic - the topic where to publish the offsets
        resumeCache - a cache instance where to store the offsets locally for faster access
        resumeAdapter - the component-specific resume adapter
        executorService - an executor service that will run a separate thread for periodically refreshing the offsets
      • MultiNodeKafkaResumeStrategy

        public MultiNodeKafkaResumeStrategy​(String topic,
                                            org.apache.camel.resume.cache.ResumeCache<K,​V> resumeCache,
                                            org.apache.camel.resume.ResumeAdapter resumeAdapter,
                                            Properties producerConfig,
                                            Properties consumerConfig)
        Builds an instance of this class
        Parameters:
        topic - the topic where to publish the offsets
        resumeCache - a cache instance where to store the offsets locally for faster access
        resumeAdapter - the component-specific resume adapter
        producerConfig - the set of properties to be used by the Kafka producer within this class
        consumerConfig - the set of properties to be used by the Kafka consumer within this class
      • MultiNodeKafkaResumeStrategy

        public MultiNodeKafkaResumeStrategy​(String topic,
                                            org.apache.camel.resume.cache.ResumeCache<K,​V> resumeCache,
                                            org.apache.camel.resume.ResumeAdapter resumeAdapter,
                                            Properties producerConfig,
                                            Properties consumerConfig,
                                            ExecutorService executorService)
        Builds an instance of this class
        Parameters:
        topic - the topic where to publish the offsets
        resumeCache - a cache instance where to store the offsets locally for faster access
        resumeAdapter - the component-specific resume adapter
        producerConfig - the set of properties to be used by the Kafka producer within this class
        consumerConfig - the set of properties to be used by the Kafka consumer within this class
        executorService - an executor service that will run a separate thread for periodically refreshing the offsets
    • Method Detail

      • refresh

        protected void refresh()
        Launch a thread to refresh the offsets periodically