From c56cefb6674c26719e8db0c7bc75a2ffde261ca6 Mon Sep 17 00:00:00 2001 From: Pierre Massat Date: Mon, 26 Dec 2016 16:24:34 +0100 Subject: [PATCH] Expose the shard ID in the buffer (#30) --- buffer.go | 6 ++++++ consumer.go | 1 + 2 files changed, 7 insertions(+) diff --git a/buffer.go b/buffer.go index 202a022..8ec02b9 100644 --- a/buffer.go +++ b/buffer.go @@ -8,6 +8,7 @@ type Buffer struct { records []*kinesis.Record firstSequenceNumber string lastSequenceNumber string + shardID string MaxRecordCount int } @@ -51,3 +52,8 @@ func (b *Buffer) FirstSeq() string { func (b *Buffer) LastSeq() string { return b.lastSequenceNumber } + +// ShardID returns the shard ID watched by the consumer +func (b *Buffer) ShardID() string { + return b.shardID +} diff --git a/consumer.go b/consumer.go index ec6a9b5..1928161 100644 --- a/consumer.go +++ b/consumer.go @@ -52,6 +52,7 @@ func (c *Consumer) Start(handler Handler) { func (c *Consumer) handlerLoop(shardID string, handler Handler) { buf := &Buffer{ MaxRecordCount: c.BufferSize, + shardID: shardID, } params := &kinesis.GetShardIteratorInput{