Best practice for IOT architecture

Vytautas Leliunas 1 Reputation point
2021-02-26T06:26:41.98+00:00

Hello,

My work is related with physical devices, such as card readers, IO modules, led displays, barcode readers and etc.
I have a class for each device. Every class initiates connection to device, handles events, and publishes events if something happens.
What I want to make is to create some DeviceEngine, which will control all these modules.
Now I have a windows service witch communicates via WCF. So if in project I need to use some modules I need to install several services.
For example if I'm doing some car entrance control solution, then I need to install Licenceplate, PLC, LedDisplay, Cardreader and main services. Some solutions contains 5-9 services.
I do not like such architecture, because if I restart one service, then WCF communication is broken and I need to restart other services as well.

What I want to do is to make is to create a DLL for each device. Lets say each driver will have a method "StartDriver". Then I want to create one service "DriverEngine" which, will scan a folder, find all Dll's adds them as assembly and calls "StartDriver". Every driver will communicate with messaging system like MQTT or ActiveMQ.

As you understand I want to create independent driver system and replace current multiple service architecture.
Maybe some of you have done similar system. What do you think, what is the best architecture for such hardware control?
Preferred .net framewrok or .net core.

br, Vytautas

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,479 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Sander van de Velde | MVP 30,396 Reputation points MVP
    2021-03-01T13:24:09.78+00:00

    Hello @Vytautas Leliunas ,

    you are describing a very specific solution for a very common use case.

    It seems you want to decouple data ingest, insights, and action using microservices. All these pieces are communication together with a servicebus.

    I recommend checking out these modules about loosely coupled services and eg. message bus.

    Regarding the logic, this can be filled in with eg. serverless Azure functions, Azure Stream Analytics or even IoT Hub (for D2C data ingest en C2D commands).