mailgun / kafka-pixy

gRPC/REST proxy for Kafka
Apache License 2.0
774 stars 118 forks source link

Simple example using Go timing out after 20 seconds #153

Closed hermanschaaf closed 6 years ago

hermanschaaf commented 6 years ago

Hi, I am trying to write a simple GRPC consumer in Go. For a start, I thought I'd try and list the available topics with ListTopics. I was able to connect to port 19092 via curl and consume messages via that route, so I think kafka-pixy is set up correctly. But using Go and gRPC I get timeouts.

Here is the code I'm running:

package main

import (
    pb "github.com/mailgun/kafka-pixy/gen/golang"
    "google.golang.org/grpc"
    "time"
    "context"
    "log"
)

func main() {
    serverAddr := "127.0.0.1:19091"
    conn, err := grpc.Dial(serverAddr, grpc.WithInsecure())
    if err != nil {
        panic(err)
    }
    defer conn.Close()
    client := pb.NewKafkaPixyClient(conn)

    ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second)
    defer cancel()

    tr := pb.ListTopicRq{}
    r, err := client.ListTopics(ctx, &tr)
    if err != nil {
        panic(err)
    }
    log.Println(r)
}

Unfortunately, it fails with:

panic: rpc error: code = DeadlineExceeded desc = context deadline exceeded

goroutine 1 [running]:
main.main()
    /Users/hermanschaaf/hermanschaaf/kafka-read-proxy/main.go:26 +0x279

Process finished with exit code 2

Does anyone know what I might be doing wrong here?

horkhe commented 6 years ago

I hate to say it, but it works for me. Are you following the steps outlined here? If it still does not work for you please provide kafka-pixy logs.

horkhe commented 6 years ago

I am closing this as not reproducible. Feel free to reopen if you have more information.