2
votes

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.

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. 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. 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. 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.

But now I'm wondering if I could just have 1 Topic and place all the logic within the metadata?

I am very new to SQLFilters with service bus so any help would be greatly appreciated :)

1

1 Answers

3
votes

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. Or Event Hubs, but they are less command pattern optimized.

1) Event Hubs

2) IoT Hubs

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. It has the recommendations, services, best practices etc that may be used for the Azure + IoT projects from the Microsoft point of view.

Another helpful resource could be 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.

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.

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.

So, as i see your solution architecture may looks like:

Device 2 Cloud:

Devices => Gateway (SuperSocket or whatever) || IoT Hub => Device Registry (see links specified above)

Cloud 2 Device:

User Interface => IoT Hub with registered device => Device

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. 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.