MMS Microservices

Last updated last month

What’s MMS (Microservices)?

  1. A microservice is a service with a design focus toward the smallest autonomous boundary

  2. It’s built, deployed and run independently from other services

  3. It manages its own information and how it communicates to/ from the outside world

  4. It handles failures so that its information isn’t los

How to develop Microservices?

ENVIRONMENT

Node.js

  • Step A

    • Install Node.js

      https://nodejs.org/en/

      Download and install under C:\nodejs

    • Installation testing

      Open <Cmd> and test if the installation was successful

      node -v // shows the version of node
  • Step B

    • Open <Cmd> and specify the path to the Node.js summary

    • Create a folder under C:\nodejs ; name it “project” mkdir C:\nodejs\project

    • cd C:\nodejs\project

      npm init //initialize node package manager

      Press “enter” until finished with all the arguments

      npm install motebus --save //install MoteBus
      npm install express --save //install express
  • Step C

    • Install MoteBus SDK

      • MoteBusHelloWorld Download link

        http://www.ypcloud.com/download/motebushelloworld.zip

      • Unzip to extract the HelloWorld folder and copy to C: \nodejs\project

      • Run C:\nodejs_project\HelloWorld\bin\MoteBus_win32.exe as an Administrator, ensuring that TCP port 6788 is open in the system's firewall

    • Run HelloWorld.js

      cd C:\nodejs\project\HelloWorld

      node index.js //runs index.js
  • Step D

    • Local Host test cd C:\nodejs\project\HelloWorld\test\

      node MoteTest.js

      MoteTest.js is a test program for testing the Motebus connector which will return the test results for Add(), Echo() & Time() functions

    • Client Server test

      • Use a code editor to open _MoteTest.js and modify the third statement of the js file

      • Find & Replace '127.0.0.1' with '192.168.10.185'

How to Publish Microservices?

  1. Put the file on the server using SSH

  2. Open <Cmd> and run the program

How to test Microservices?

  • Users can do their own coding

  • With the help of the environment set and MoteBus package mentioned earlier, Microservices can be transmitted via MoteBus xRPC (MoteView https://moteview.ypcloud.com)