How to build a simple IoT Edge Version 2 Heartbeat Module

%3CLINGO-SUB%20id%3D%22lingo-sub-141482%22%20slang%3D%22en-US%22%3EHow%20to%20build%20a%20simple%20IoT%20Edge%20Version%202%20Heartbeat%20Module%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-141482%22%20slang%3D%22en-US%22%3E%3CP%3ERecently%2C%20the%20Microsoft%20Azure%20IoT%20Edge%20platform%20was%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fnl-nl%2Fupdates%2Fiot-edge-december-update%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eupdated%3C%2FA%3E%20with%20more%20features%2C%20better%20documentation%20and%20lots%20of%20goodies.%3C%2FP%3E%0A%3CP%3EYes%2C%20the%20learning%20curve%20of%20this%20new%20version%20is%20steep%2C%20especially%20if%20you%20are%20new%20(like%20me)%20to%20%3CA%20href%3D%22https%3A%2F%2Fhub.docker.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EDocker%3C%2FA%3E.%20But%20once%20you%20just%20have%20started%20building%20your%20own%20Edge%20solution%2C%20things%20seem%20to%20fall%20into%20place.%3C%2FP%3E%0A%3CP%3EA%20logical%20flow%20seems%20to%20be%20described%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EMicrosoft%20documentation%3C%2FA%3E%3A%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-simulate-device-windows%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESimulate%20an%20IoT%20Edge%20device%20in%20Windows%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-simulate-device-Linux%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESimulate%20an%20IoT%20Edge%20device%20in%20Linux%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-csharp-module%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDevelop%20and%20deploy%20a%20C%23%20module%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-deploy-stream-analytics%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20Azure%20Stream%20Analytics%20as%20a%20module%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-deploy-machine-learning%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20Azure%20Machine%20Learning%20as%20a%20module%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fiot-edge%2Ftutorial-deploy-function%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EDeploy%20Azure%20Functions%20as%20a%20module%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ELooks%20easy%2C%20doesn't%20it%3F%3C%2FP%3E%0A%3CP%3EBut%20reading%20the%20comments%2C%20people%20are%20still%20confused.%3C%2FP%3E%0A%3CP%3EFirst%20of%20all%3A%20DO%20NOT%20MIX%20VERSION%20ONE%20AND%20VERSION%20TWO%20DOCUMENTATION.%3C%2FP%3E%0A%3CP%3EVersion%20one%20is%20based%20on%20one%20executable%20(gw.exe)%20which%20injects%20classes%20from%20DLL's%20(a%20configuration%20file%20has%20to%20be%20supplied).%20Modules%20are%20just%20classes%20in%20the%20DLL's.%3C%2FP%3E%0A%3CP%3EVersion%20two%20is%20based%20on%20Docker%20Containers%2C%26nbsp%3Beach%20module%20is%20a%20separate%20container%20and%20therefore%20each%20module%20is%20a%20separate%20executable.%20These%20modules%20share%20the%20same%20logic%20to%20connect%20to%20a%20message%20bus%20which%20provides%20the%20routing.%20This%20'runtime'%20has%20to%20be%20installed%20on%20the%20Edge%20machine%2C%20next%20to%2Foutside%20the%20Docker%20containers.%3C%2FP%3E%0A%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsandervandevelde.files.wordpress.com%2F2018%2F01%2Fv01.png%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3E%3CIMG%20class%3D%22alignnone%20size-medium%20wp-image-4532%22%20src%3D%22https%3A%2F%2Fsandervandevelde.files.wordpress.com%2F2018%2F01%2Fv01.png%3Fw%3D300%22%20border%3D%220%22%20alt%3D%22%22%20width%3D%22300%22%20height%3D%22157%22%20%2F%3E%3C%2FA%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3ENote%3C%2FEM%3E%3A%20the%20good%20thing%20is%20that%20the%20architecture%20still%20stands%2C%20multiple%20modules%20on%20top%20of%20a%20messagebus%20and%20messages%20are%20routed.%20The%20better%20thing%20is%20that%20the%20routing%20is%20now%20far%20more%20intelligent.%20And%20Microsoft%20has%20provided%20some%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2FAzure%2Fiot-edge%2Fblob%2Fmaster%2Fv1%2Fdoc%2Fmigration_from_v1_to_v2.md%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eguidance%20for%20migration%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EAfter%20that%2C%20work%20your%20way%20through%20the%20documentation%20provided%20above%2C%20and%20check%20out%20my%20recent%20blogs%3A%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fsandervandevelde.wordpress.com%2F2017%2F12%2F30%2Fdeploy-an-azure-streamanalytics-job-on-the-iotedge%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EDeploy%20an%20Azure%20StreamAnalytics%20Job%20on%20the%20IotEdge%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fsandervandevelde.wordpress.com%2F2017%2F12%2F27%2Fintroduction-to-the-microsoft-azureiotedge-modbus-tcp-iotedge-module%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EIntroduction%20to%20the%20Microsoft%20Azure%20IoTEdge%20Modbus-tcp-iotedge%20module%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fsandervandevelde.wordpress.com%2F2017%2F12%2F24%2Fbetter-property-roundtrip-for-azure-iotedge-module-twin%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EBetter%20property%20roundtrip%20for%20Azure%20IoIEdge%20Module%20Twin%3C%2FA%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3EOK%2C%20I%20know%2C%20the%20learning%20curve%20is%20still%20steep.%20How%20about%20a%20full%20example%20of%20a%20simple%20module%3F%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20full%20article%20can%20be%20found%20%3CA%20href%3D%22https%3A%2F%2Fsandervandevelde.wordpress.com%2F2018%2F01%2F04%2Fhow-to-build-a-simple-iot-edge-version-2-heartbeat-module%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehere%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20source%20code%20of%20this%20module%20is%20available%20on%20%3CA%20href%3D%22https%3A%2F%2Fgithub.com%2Fsandervandevelde%2Fiot-edge-heartbeat%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EGithub%3C%2FA%3E%3C%2FP%3E%0A%3CP%3EThe%20module%20is%20available%20for%20download%20as%20a%20%3CA%20href%3D%22https%3A%2F%2Fhub.docker.com%2Fr%2Fsvelde%2Fiot-edge-heartbeat%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3EDocker%20image%3C%2FA%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-141482%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20IoT%20Hub%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EIoTEdge%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
MVP

Recently, the Microsoft Azure IoT Edge platform was updated with more features, better documentation and lots of goodies.

Yes, the learning curve of this new version is steep, especially if you are new (like me) to Docker. But once you just have started building your own Edge solution, things seem to fall into place.

A logical flow seems to be described in the Microsoft documentation:

  1. Simulate an IoT Edge device in Windows
  2. Simulate an IoT Edge device in Linux
  3. Develop and deploy a C# module
  4. Deploy Azure Stream Analytics as a module
  5. Deploy Azure Machine Learning as a module
  6. Deploy Azure Functions as a module

Looks easy, doesn't it?

But reading the comments, people are still confused.

First of all: DO NOT MIX VERSION ONE AND VERSION TWO DOCUMENTATION.

Version one is based on one executable (gw.exe) which injects classes from DLL's (a configuration file has to be supplied). Modules are just classes in the DLL's.

Version two is based on Docker Containers, each module is a separate container and therefore each module is a separate executable. These modules share the same logic to connect to a message bus which provides the routing. This 'runtime' has to be installed on the Edge machine, next to/outside the Docker containers.

Note: the good thing is that the architecture still stands, multiple modules on top of a messagebus and messages are routed. The better thing is that the routing is now far more intelligent. And Microsoft has provided some guidance for migration

After that, work your way through the documentation provided above, and check out my recent blogs:

OK, I know, the learning curve is still steep. How about a full example of a simple module?

 

The full article can be found here

The source code of this module is available on Github

The module is available for download as a Docker image

0 Replies