I'm fighting with Google Docs for setting up Cloud PubSub with .NET using a PubSub emulator.
https://cloud.google.com/dotnet/docs/getting-started/using-pub-sub
https://cloud.google.com/pubsub/docs/publisher
https://cloud.google.com/pubsub/docs/emulator
Coming from a Rails background, I'm tasked to implement Cloud PubSub for a .NET product, running our google cloud on .NET Core, to enable it to publish.
Google::Cloud::Pubsub.new(project: project_id, emulator_host: emulator_host)
From the documentation using .NET, I keep coming back to the following:
PublisherServiceApiClient publisherClient = PublisherServiceApiClient.Create();
PublisherClient publisher = PublisherClient.Create(...)
However, the library used from the docs Google.Cloud.PubSub.V1 -Pre
does not contain the definition.
'PublisherClient' does not contain a definition for 'Create'
.
Instead, I get CreateAsync
that takes in TopicName
, PublisherClient.ClientCreationSettings
and PublisherClient.Settings
.
I noticed that PublisherServiceApiClient
can take in a Channel
, but I'm confused on how to get this going.
To conclude with an actual question, how does one currently implement Cloud PubSub with .NET for in cloud and then locally with emulator? Adding to that, am I using the wrong library or the wrong docs?
Any suggestions, pointers or piece of advice would be truly appreciated.
PublisherClient.Create()
... – fbelangerPublisherClient
, you should indeed useCreateAsync
. We don't currently have any direct emulator support, although there's work afoot that might make that simpler. You could specify aPublisherClient.ClientCreationSettings
with a suitableServiceEndpoint
andChannelCredentials.Insecure
to talk to the emulator though. I won't add an answer to this question at the moment as it's not a clear question to answer - some parts appear to be about docs, some about creation, and some about the emulator. If you could clarify this to a specific question, it would be easier to add an answer. – Jon Skeet