diff --git a/README.md b/README.md index bfbae2c..779b560 100644 --- a/README.md +++ b/README.md @@ -234,6 +234,22 @@ The [expvar package](https://golang.org/pkg/expvar/) will display consumer count }, ``` +### Consumer starting point + +Kinesis allows consumers to specify where on the stream they'd like to start consuming from. The default in this library is `LATEST` (Start reading just after the most recent record in the shard). + +This can be adjusted by using the `WithShardIteratorType` option in the library: + +```go +// override starting place on stream to use TRIM_HORIZON +c, err := consumer.New( + *stream, + consumer.WithShardIteratorType(kinesis.ShardIteratorTypeTrimHorizon) +) +``` + +[See AWS Docs for more options.](https://docs.aws.amazon.com/kinesis/latest/APIReference/API_GetShardIterator.html) + ### Logging Logging supports the basic built-in logging library or use thrid party external one, so long as diff --git a/consumer.go b/consumer.go index adbb000..e9c583a 100644 --- a/consumer.go +++ b/consumer.go @@ -26,7 +26,7 @@ func New(streamName string, opts ...Option) (*Consumer, error) { // new consumer with no-op checkpoint, counter, and logger c := &Consumer{ streamName: streamName, - initialShardIteratorType: kinesis.ShardIteratorTypeTrimHorizon, + initialShardIteratorType: kinesis.ShardIteratorTypeLatest, checkpoint: &noopCheckpoint{}, counter: &noopCounter{}, logger: &noopLogger{