Expose the shard ID in the buffer (#30)

This commit is contained in:
Pierre Massat 2016-12-26 16:24:34 +01:00 committed by Harlow Ward
parent fedb6812fb
commit c56cefb667
2 changed files with 7 additions and 0 deletions

View file

@ -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
}

View file

@ -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{