简体   繁体   English

Azure服务总线-多个主题?

[英]Azure Service Bus - Multiple topics?

so a brief summary of what Im working with at the moment : 因此,我简要介绍了我目前正在使用的工具:

Im deciding whether I can do this with 1 topic vs needing N topics and both with the relevant metadata/filters. 我正在决定是否可以使用1个主题来进行此操作,而不是需要N个主题,并且都可以使用相关的元数据/过滤器来做到这一点。

I have 3 pieces pretty much; 我几乎有三件; a socket server (worker role) of which units in the field connect to, Azure Service Bus messaging and finally a web app. 一个套接字服务器(工作者角色),在该服务器中,该字段中的单元连接到该服务器,Azure Service Bus消息传递,最后是一个Web应用程序。 The user can queue commands to be sent to devices via the web app but we need to be able to hold messages in the queue until the device comes online of which it will then get all the messages. 用户可以将要通过Web应用程序发送到设备的命令排队,但是我们需要能够将消息保留在队列中,直到设备联机,然后设备将获得所有消息。 This is where I am confused... 这就是我感到困惑的地方...

I was initially working along the lines of dynamically creating 1-9999 topics (limit of 10 000 topics can be created, so using last 4 chars of serial) at the web app on messages being queued. 最初,我是在Web应用程序上针对正在排队的消息动态地创建1-9999个主题(可以创建10,000个主题,因此使用连续的4个字符)。 Will then have the devices full serial within the metadata. 然后,设备将在元数据中具有完整的序列号。 This way as devices connect to the socket server I can create N subscriptions with specific rules and shut them down when the devices disconnect. 这样,当设备连接到套接字服务器时,我可以创建具有特定规则的N个订阅,并在设备断开连接时将其关闭。

But now I'm wondering if I could just have 1 Topic and place all the logic within the metadata? 但是现在我想知道我是否只能拥有1个主题并将所有逻辑放在元数据中?

I am very new to SQLFilters with service bus so any help would be greatly appreciated :) 我对带有服务总线的SQLFilters很陌生,因此任何帮助将不胜感激:)

Good question! 好问题! First of all, i should say that i would use IoT Hubs in your situation which is the "queue"-like service optimized for IoT scenarios, management and commanding included. 首先,我要说的是,在您的情况下,我将使用IoT中心,这是针对IoT场景,包括管理和命令而优化的“队列”式服务。 Or Event Hubs, but they are less command pattern optimized. 或事件中心,但它们对命令模式的优化较少。

1) Event Hubs 1)活动中心

2) IoT Hubs 2)物联网中心

The first one is for scenarios that are more events-oriented. 第一个是面向事件的方案。 What i mean - to implement the management of the device from the backend will be more complex with the Event Hubs and less complex with the IoT Hubs. 我的意思是-从后端实施设备管理将通过事件中心变得更加复杂,而通过物联网中心变得更加简单。

I would highly recommend you to take a look at these services, because Service Bus is the great service, but the listed services are more IoT-oriented. 我强烈建议您看一下这些服务,因为服务总线是很棒的服务,但是列出的服务更面向物联网。

From the architecture standpoint, recently Microsoft published the IoT Reference Architecture whitepaper that you may download here. 从体系结构的角度来看,Microsoft最近发布了IoT参考体系结构白皮书,您可以在此处下载。 It has the recommendations, services, best practices etc that may be used for the Azure + IoT projects from the Microsoft point of view. 从Microsoft的角度来看,它具有可用于Azure + IoT项目的建议,服务,最佳实践等。

Another helpful resource could be http://azureiotsuite.com . 另一个有用的资源可能是http://azureiotsuite.com It is the reference IoT architecture implemented. 这是已实现的参考物联网架构。 So, if you click on the Create, you will have one of two reference architectures (remote monitoring or predictive maintenance) in your Azure subscription and you will be able to review all of the flows. 因此,如果单击“创建”,则Azure订阅中将具有两种参考体系结构之一(远程监视或预测性维护),并且您将能够查看所有流。

So, i would recommend to consider to use IoT/Event Hubs instead of the SB Topics/Queues because in the IoT field, the service that is optimized for these workloads should perform better than non-optimized initially. 因此,我建议考虑使用IoT /事件中心而不是SB主题/队列,因为在IoT领域,针对这些工作负载进行了优化的服务应比最初未优化的服务表现更好。

Second, you did not specify how you connect your devices to the Worker Role, so as i saw there is a good library for doing that called SuperSocket . 其次,您没有指定如何将设备连接到Worker Role,因此我看到有一个很好的库可以称为SuperSocket

So, as i see your solution architecture may looks like: 因此,正如我所见,您的解决方案体系结构可能类似于:

Device 2 Cloud: 设备2云:

Devices => Gateway (SuperSocket or whatever) || 设备=>网关(SuperSocket或其他)|| IoT Hub => Device Registry (see links specified above) IoT中心=>设备注册表(请参阅上面指定的链接)

Cloud 2 Device: Cloud 2设备:

User Interface => IoT Hub with registered device => Device 用户界面=>具有已注册设备的IoT中心=>设备

Device Registry is more convenient way to do the IoT flows than transferring IDs or etc. Dynamic creation of entities has some downsides - imagine, if creation command will return timeout error, for example. 与传送ID或类似信息相比,设备注册表是进行IoT流程更方便的方法。实体的动态创建有一些缺点-想象一下,例如,如果创建命令将返回超时错误。 Better to use optimized services, i believe. 我相信最好使用优化的服务。

When the device is offline, it will not poll the queue. 设备处于脱机状态时,它不会轮询队列。 Messages have some retention time before they will be stalled, that is the built-in mechanism. 消息有一定的保留时间,然后才能停止,这是内置机制。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM