All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.amazonaws.services.kinesis.clientlibrary.lib.worker.PeriodicShardSyncStrategy Maven / Gradle / Ivy

Go to download

The Amazon Kinesis Client Library for Java enables Java developers to easily consume and process data from Amazon Kinesis.

The newest version!
package com.amazonaws.services.kinesis.clientlibrary.lib.worker;


/**
 * An implementation of ShardSyncStrategy.
 */
class PeriodicShardSyncStrategy implements ShardSyncStrategy {

    private IPeriodicShardSyncManager periodicShardSyncManager;

    PeriodicShardSyncStrategy(IPeriodicShardSyncManager 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();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy