Google-cloud-ruby: In Pubsub: NameError: uninitialized constant Google::Cloud::Pubsub::V1::Subscriber

Created on 21 Jan 2018  路  3Comments  路  Source: googleapis/google-cloud-ruby

irb(main):004:0> subscriber_client = Google::Cloud::Pubsub::V1::Subscriber.new
NameError: uninitialized constant Google::Cloud::Pubsub::V1::Subscriber
Did you mean?  Google::Cloud::Pubsub::V1::SubscriberClient
    from (irb):4
    from /Users/mackeee/.rbenv/versions/2.4.2/bin/irb:11:in `<main>'
pubsub question

Most helpful comment

You can find the SubscriberClient documentation here:

https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-pubsub/v0.29.0/google/cloud/pubsub/v1/subscriberclient

The Pub/Sub gem has two different APIs, the public API and the low-level API. SubscriberClient is the low-level API. I would suggest looking at Subscriber#listen, which is the public API for streaming subscription messages.

All 3 comments

Have you tried the following?

 subscriber_client = Google::Cloud::Pubsub::V1::SubscriberClient.new

@blowmage thank you. I can use it.
Are there api document of SubscriberClient ??
I wanna use streaming function.

You can find the SubscriberClient documentation here:

https://googlecloudplatform.github.io/google-cloud-ruby/#/docs/google-cloud-pubsub/v0.29.0/google/cloud/pubsub/v1/subscriberclient

The Pub/Sub gem has two different APIs, the public API and the low-level API. SubscriberClient is the low-level API. I would suggest looking at Subscriber#listen, which is the public API for streaming subscription messages.

Was this page helpful?
0 / 5 - 0 ratings