com.amazonaws.services.kinesis.clientlibrary.lib.worker.PeriodicShardSyncStrategy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of amazon-kinesis-client Show documentation
Show all versions of amazon-kinesis-client Show documentation
The Amazon Kinesis Client Library for Java enables Java developers to easily consume and process data
from Amazon Kinesis.
package com.amazonaws.services.kinesis.clientlibrary.lib.worker;
/**
* An implementation of ShardSyncStrategy.
*/
class PeriodicShardSyncStrategy implements ShardSyncStrategy {
private PeriodicShardSyncManager periodicShardSyncManager;
PeriodicShardSyncStrategy(PeriodicShardSyncManager periodicShardSyncManager) {
this.periodicShardSyncManager = periodicShardSyncManager;
}
@Override
public ShardSyncStrategyType getStrategyType() {
return ShardSyncStrategyType.PERIODIC;
}
@Override
public TaskResult syncShards() {
return periodicShardSyncManager.start();
}
@Override
public TaskResult onWorkerInitialization() {
return syncShards();
}
@Override
public TaskResult onFoundCompletedShard() {
return new TaskResult(null);
}
@Override
public TaskResult onShardConsumerShutDown() {
return new TaskResult(null);
}
@Override
public void onWorkerShutDown() {
periodicShardSyncManager.stop();
}
}