一次部署具有多个主题和队列的ServiceBus

编程入门 行业动态 更新时间:2024-10-26 18:22:41
本文介绍了一次部署具有多个主题和队列的ServiceBus的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我对使用Servicebus和其他Azure功能还很陌生.在Azure门户上手动创建Servicebus之后,我尝试弄清楚如何自动实现.经过一段时间的阅读,我认为使用天蓝色资源管理器应该是可行的方法.仅部署一个主题没什么大不了的.但是我找不到一个示例,该示例显示了如何一次部署多个主题和队列.还是我使用错误的方法?

I'm fairly new to using the servicebus and other Azure features. After creating a servicebus manually on the Azure portal, I try to figure out how this can be achieved automatically. After a while of reading I thought that using the azure resource manager should be the way to go. Deploying just one topic is no big deal. But I can't find an example, that shows how to deploy multiple topics and queues at once. Or am I on the wrong approach?

感谢您的回答! 赫尔穆特

Thanks for your answers! Helmut

推荐答案

我们的工作很简单(我看到其他团队也在这样做)很简单:当您的生产者/消费者应用程序启动时,它会检查是否需要队列/主题/订阅存在,否则创建它们.

What we do (and I saw other teams doing the same) is simple: when your producer/consumer application starts, it checks if required queues/topics/subscriptions exist, and creates them otherwise.

因此,我们从C#代码创建所有服务总线实体,这也为选项提供了充分的灵活性.

So we create all Service Bus entities from C# code, which also gives the full flexibility for options.

代码示例:

var namespaceManager = NamespaceManager.CreateFromConnectionString(connectionString); if (!namespaceManager.TopicExists(topicName)) { namespaceManager.CreateTopic(new TopicDescription(topicName)); namespaceManager.CreateSubscription( new SubscriptionDescription(topicName, subscriptionName)); }

这并不是说您的ARM方法是对还是错,只是为了给出一个简单的选择.

That's not to say your ARM approach is wrong or bad, just to give a simple alternative.

更多推荐

一次部署具有多个主题和队列的ServiceBus

本文发布于:2023-07-17 03:41:09,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1129047.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:多个   队列   主题   ServiceBus

发布评论

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

>www.elefans.com

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