检查EventHub名称空间和实例是否存在 [英] Check if the EventHub namespace and instance exists

查看:59
本文介绍了检查EventHub名称空间和实例是否存在的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个C#应用程序,该程序将数据发送到evenhub.如何检查程序以确保eventhub的名称空间和实例确实存在?

I am writing a C# app which sends data to evenhub. How do I check in my program to ensure that the namespace and instance of eventhub does exist?

谢谢

 

推荐答案

我想直接的方法是尝试使用 ConnectionString 并捕获引发的所有异常.

I guess the direct way would be to just try creating an EventHubClient using the ConnectionString and catch any exceptions thrown.

另一种方法是使用Management API列出所有 命名空间 实例按命名空间 检查它们是否存在.甚至直接尝试获取 命名空间 实例的名称,并处理不存在的错误.

Another way would be to use the Management API to list all namespaces or instances by namespace to check if they exist. Or even directly try get namespace or instance by their names and handle the errors returned if they don't exist.


这篇关于检查EventHub名称空间和实例是否存在的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆