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

de.otto.synapse.endpoint.receiver.aws.KinesisMessageLogIterator Maven / Gradle / Ivy

Go to download

A library used at otto.de to implement Spring Boot based event-sourcing microserivces.

There is a newer version: 0.10.1
Show newest version
package de.otto.synapse.endpoint.receiver.aws;

import com.google.common.collect.ImmutableMap;

import javax.annotation.Nonnull;
import java.util.List;

import static com.google.common.collect.Maps.uniqueIndex;
import static java.util.Objects.requireNonNull;

public class KinesisMessageLogIterator {

    private final ImmutableMap shardIterators;

    public KinesisMessageLogIterator(final @Nonnull List shardIterators) {
        this.shardIterators = uniqueIndex(shardIterators, (iter) -> iter.getShardPosition().shardName());
    }

    @Nonnull
    public KinesisShardIterator getShardIterator(final String shardName) {
        return requireNonNull(
                shardIterators.get(shardName),
                "Unknown shard " + shardName
        );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy