twitchscience / kinsumer

Native Go consumer for AWS Kinesis streams.
Other
134 stars 35 forks source link

Blocked at `.Next()` #55

Closed jney closed 4 years ago

jney commented 4 years ago

Here is a sample of our code we rewrote using kinsumer instead of https://github.com/harlow/kinesis-consumer. It used to work using kinesis-consumer but we could only have one consumer per application. Anyway, we wrote the following code but we are stuck at k.Next(), the last log before next

    s := session.Must(session.NewSession(&aws.Config{
        Endpoint:   cfg.KinesisEndpoint,
        Region:     cfg.AWSRegion,
    }))
    config := kinsumer.NewConfig().
        WithThrottleDelay(time.Second).
        WithShardCheckFrequency(time.Second)
    k, _ := kinsumer.NewWithSession(s, streamName, fmt.Sprintf("%s_my_app", env), uuid.New().String(), config)
    var wg sync.WaitGroup
    wg.Add(1)
    go func() {
        defer wg.Done()
        for {
            log.Info("before Next")
            k.Next()
            log.Info("inside Next")
        }
    }()
    wg.Wait()

Do someone have a any idea what we did wrong? Thank you

garethlewin commented 4 years ago

You didn't call Run(). There is a simple sample app here https://github.com/twitchscience/kinsumer/blob/master/cmd/noopkinsumer/main.go

garethlewin commented 4 years ago

(Closed the issue because I believe this answers the question, if you have more questions feel free to reopen or make a new issue)