Class MultiNodeKafkaResumeStrategy<K extends org.apache.camel.resume.Resumable>
- java.lang.Object
-
- org.apache.camel.processor.resume.kafka.SingleNodeKafkaResumeStrategy<K>
-
- org.apache.camel.processor.resume.kafka.MultiNodeKafkaResumeStrategy<K>
-
- Type Parameters:
K
- the type of key
- All Implemented Interfaces:
AutoCloseable
,KafkaResumeStrategy<K>
,org.apache.camel.resume.ResumeStrategy
,org.apache.camel.resume.UpdatableConsumerResumeStrategy<K>
,org.apache.camel.Service
public class MultiNodeKafkaResumeStrategy<K extends org.apache.camel.resume.Resumable> extends SingleNodeKafkaResumeStrategy<K>
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(KafkaResumeStrategyConfiguration resumeStrategyConfiguration)
Create a new instance of this classMultiNodeKafkaResumeStrategy(KafkaResumeStrategyConfiguration resumeStrategyConfiguration, ExecutorService executorService)
Builds an instance of this class
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
loadCache()
Loads the existing data into the cacheprotected void
poll()
protected void
poll(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer)
void
stop()
-
Methods inherited from class org.apache.camel.processor.resume.kafka.SingleNodeKafkaResumeStrategy
build, checkAndSubscribe, checkAndSubscribe, close, consume, consume, consume, doAdd, getAdapter, getConsumer, getConsumerRebalanceListener, getPollDuration, getProducer, getProducerErrors, getResumeStrategyConfiguration, init, produce, resetProducerErrors, setAdapter, setPollDuration, start, subscribe, unsubscribe, updateLastOffset
-
-
-
-
Constructor Detail
-
MultiNodeKafkaResumeStrategy
public MultiNodeKafkaResumeStrategy(KafkaResumeStrategyConfiguration resumeStrategyConfiguration)
Create a new instance of this class- Parameters:
resumeStrategyConfiguration
- the configuration to use for this strategy instance
-
MultiNodeKafkaResumeStrategy
public MultiNodeKafkaResumeStrategy(KafkaResumeStrategyConfiguration resumeStrategyConfiguration, ExecutorService executorService)
Builds an instance of this class- Parameters:
resumeStrategyConfiguration
- the configuration to use for this strategy instanceexecutorService
- an executor service that will run a separate thread for periodically refreshing the offsets
-
-
Method Detail
-
poll
protected void poll()
- Overrides:
poll
in classSingleNodeKafkaResumeStrategy<K extends org.apache.camel.resume.Resumable>
-
poll
protected void poll(org.apache.kafka.clients.consumer.Consumer<byte[],byte[]> consumer)
-
loadCache
public void loadCache() throws Exception
Description copied from class:SingleNodeKafkaResumeStrategy
Loads the existing data into the cache- Specified by:
loadCache
in interfaceorg.apache.camel.resume.ResumeStrategy
- Overrides:
loadCache
in classSingleNodeKafkaResumeStrategy<K extends org.apache.camel.resume.Resumable>
- Throws:
Exception
-
stop
public void stop()
- Specified by:
stop
in interfaceorg.apache.camel.Service
- Overrides:
stop
in classSingleNodeKafkaResumeStrategy<K extends org.apache.camel.resume.Resumable>
-
-