google-cloud-go: Method not found: google.pubsub.v1.Subscriber/StreamingPull
Client
PubSub “0.20.0” Grpc “v1.11.1”
Environment
MacOS with following docker-compose:
version: '2'
services:
pubsub:
image: adilsoncarvalho/gcloud-pubsub-emulator
ports:
- "8590:8085"
Problem
Can someone please help me figure this out, I feel like I have no idea what is going on. The following code return this error:
FATA[0000] PubSub projects/<<project>>/subscriptions/<<sub>> FAILED to start: rpc error: code = Unimplemented desc = Method not found: google.pubsub.v1.Subscriber/StreamingPull
Code:
func (ps *PubSub) ListenClusterRecieve() {
ctx := context.Background()
err := ps.subscription.Receive(ctx, func(ctx context.Context, m *pubsub.Message) {
msg := &payload.msg{}
proto.Unmarshal(m.Data, msg)
if ps.Process(*msg) {
m.Ack() // Acknowledge that we've consumed the message.
} else {
m.Nack()
}
})
if err != nil {
log.Fatalf("PubSub %s FAILED to start: %v", ps.queueClusterSub, err)
}
}
I have been looking for ways to somehow deactive GRPc for pubsub, but I’m not sure that’s how it works. I have also been debugging deep in the source-code but haven’t quite figured out why this happens. It seems to happen after the this: https://github.com/GoogleCloudPlatform/google-cloud-go/blob/master/pubsub/subscription.go#L452
Using the same version of both PubSub and grpc I am able to successfully publish messages on topics, it’s just the receiving that doesn’t work.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Comments: 15 (7 by maintainers)
Okay thank you. I guess there isn’t an official image available somewhere?
Edit: For anyone looking for an image. I got this to work: https://hub.docker.com/r/bigtruedata/gcloud-pubsub-emulator/ it looks to be updated regurarly.
Thank you for the help! Sorry that it ended up being a rather silly problem hehe
Just a clarification, for posterity:
gcloud beta emulators pubsub
. It runs in its own process and can be accessed from any language.We’re here to help!
Ahh ok! So, that emulator I linked is our official emulator that’s usually used for real-ish-world-tests, benchmarking, and so on. The emulator you linked I’ve not seen before. pstest is an in-memory emulator written in Go that’s usually used for integration tests.