1

I am pushing some data to a topic in Google Pub Sub. Following code pushes a message to the topic:

   PublishResponse response = client.Publish(topic, messages);

client is PublisherClient and message is a PubSubMessage.

Now this response object doesn't tell me if the publish was successful or not. I check the API docs: https://googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.PubSub.V1/api/Google.Cloud.PubSub.V1.PublishResponse.html

But no help. I am in the middle of a big project, thus I can't run this code and check what all values I can get in response object.

Thus it will be great if someone can shed some light on this mystic object PublishResponse

Savaratkar
  • 1,974
  • 1
  • 24
  • 44

2 Answers2

2

The Publish method will throw an exception if something fails.

Jeffrey Rennie
  • 3,193
  • 1
  • 18
  • 19
1

Publish method will return PublishResponse as an output where MessageIDs will be populated if messages have been successfully published else if there is any issue in publishing , An exception of Type RPCException will be thrown.

AleXelton
  • 767
  • 5
  • 27