harlow / kinesis-consumer

Golang library for consuming Kinesis stream data
MIT License
263 stars 88 forks source link

undefined functions -- consumer.WithMaxRecords and consumer.WithScanInterval #115

Closed prashantssingh closed 4 years ago

prashantssingh commented 4 years ago

I am tring to intialise kinesis consumer by passing configurations to the option interface in consumer.New() For WithClient(), WithShardIteratorType(), it works perfectly. But for some reason, WithMaxRecords() and WithScanInterval() fails with error "undefined".

Below is the code sample Im using for initialisation:

var client = kinesis.New(session.Must(session.NewSession(
    aws.NewConfig().
    WithEndpoint(kinesisEndpoint).
    WithRegion(awsRegion),
)))

kinesisConsumer, err = consumer.New(
    kinesisStreamName,
    consumer.WithClient(client),
    consumer.WithMaxRecords(10),
    consumer.WithShardIteratorType(kinesis.ShardIteratorTypeTrimHorizon),
    consumer.WithScanInterval(time.Duration(kinesisConsumerScanIntervalInMS)*time.Millisecond),
)

I am not sure what I am doing wrong or missing out that initialisation works for two methods and fails for other two.

Please note, I have tried changing their order but no luck there.

harlow commented 4 years ago

hi @patstrom would you mind seeing which version of the consume you have in go mod (sha)? both of those config options were added recently I think... so maybe using older version of the repo?

patstrom commented 4 years ago
require (
    github.com/harlow/kinesis-consumer v0.3.4-0.20200117182210-bc5c012fd397
)

Cannot really remember but I assume I did something like go get -u harlow/kinesis-consumer@<commit>

The issue is probably that you (@harlow) need to create a new release, otherwise the go module system won't automatically find the latest features.

harlow commented 4 years ago

Great point! the last Tag was created in 2019. I've cut a new tag that should include all of the new initializers. @prashantssingh I'll close this for now, but please feel free to re-open if you are still having issues.

prashantssingh commented 4 years ago

Hi, sorry for loss of communication on my end. And yes, updating the tag to 0.3.4 did solved the problem. Thank you so much for the help.