如何在使用.net库的Google Pub Sub中成功了解发布?(How to know publish is successful in Google Pub Sub using .net lib

编程入门 行业动态 更新时间:2024-10-27 04:26:47
如何在使用.net库的Google Pub Sub中成功了解发布?(How to know publish is successful in Google Pub Sub using .net library?)

我正在将一些数据推送到Google Pub Sub中的主题。 以下代码将消息推送到主题:

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

client是PublisherClient , message是PubSubMessage 。

现在这个response对象没有告诉我发布是否成功。 我查看了API文档: https : //googlecloudplatform.github.io/google-cloud-dotnet/docs/Google.Cloud.PubSub.V1/api/Google.Cloud.PubSub.V1.PublishResponse.html

但没有帮助。 我正处于一个大项目的中间,因此我无法运行此代码并检查我可以在response对象中获得的所有值。

因此,如果有人可以对这个神秘物体PublishResponse

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

最满意答案

如果出现故障,Publish方法将抛出异常。

The Publish method will throw an exception if something fails.

更多推荐

本文发布于:2023-08-04 16:16:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1418946.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何在   Google   net   Pub   successful

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!