Class MultiNodeKafkaResumeStrategy<K,V>
- java.lang.Object
-
- org.apache.camel.processor.resume.kafka.SingleNodeKafkaResumeStrategy<K,V>
-
- org.apache.camel.processor.resume.kafka.MultiNodeKafkaResumeStrategy<K,V>
-
- Type Parameters:
K
- the type of keyV
- 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 Summary
Constructors Constructor Description 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 classMultiNodeKafkaResumeStrategy(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 classMultiNodeKafkaResumeStrategy(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 classMultiNodeKafkaResumeStrategy(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
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
refresh()
Launch a thread to refresh the offsets periodicallyvoid
stop()
-
Methods inherited from class org.apache.camel.processor.resume.kafka.SingleNodeKafkaResumeStrategy
build, checkAndSubscribe, checkAndSubscribe, close, consume, consume, createConsumer, createProducer, getAdapter, getConsumer, getConsumerConfig, getConsumerRebalanceListener, getPollDuration, getProducer, getProducerConfig, getProducerErrors, getResumeCache, getTopic, init, loadCache, produce, resetProducerErrors, setPollDuration, start, subscribe, unsubscribe, updateLastOffset
-
-
-
-
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 brokertopic
- the topic where to publish the offsetsresumeCache
- a cache instance where to store the offsets locally for faster accessresumeAdapter
- 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 offsetsresumeCache
- a cache instance where to store the offsets locally for faster accessresumeAdapter
- the component-specific resume adapterexecutorService
- 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 offsetsresumeCache
- a cache instance where to store the offsets locally for faster accessresumeAdapter
- the component-specific resume adapterproducerConfig
- the set of properties to be used by the Kafka producer within this classconsumerConfig
- 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 offsetsresumeCache
- a cache instance where to store the offsets locally for faster accessresumeAdapter
- the component-specific resume adapterproducerConfig
- the set of properties to be used by the Kafka producer within this classconsumerConfig
- the set of properties to be used by the Kafka consumer within this classexecutorService
- 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
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.apache.camel.Service
- Overrides:
stop
in classSingleNodeKafkaResumeStrategy<K,V>
-
-