This is a repository in the microservice demonstration system for the Tao of Microservices book (chapter 9). This code is live at msr.com. To get started, visit the msr/tao repository.
This microservice provides the descriptor module data functionality.
To run this microservice normally, use the tooling describing in the msr/tao repository, which shows you how to run the entire system of microservices (of which this is only one of many) in production (Kubernetes), staging (Docker), and development (fuge) modes.
To run from the terminal for testing and debugging, see the Running from the terminal section below.
The table shows how this microservice acts on the Accepted
message
patterns and performs appropriate business Actions
, as a result of
which, new messages are possibly Sent
.
Accepted | Actions | Sent |
---|---|---|
role:descriptor,cmd:get (SC) |
Get descriptor data about a module | |
role:info,need:part (AO) |
Provide partial module information | role:info,collect:part (AO) |
(KEY: A: asynchronous, S: synchronous, O: observed, C: consumed)
Unit tests are in the test folder. To run, use:
$ descriptor test
Note that this is a learning system, and the tests are not intended to be high coverage.
This microservice is written in node.js, which you
will need to download and install. Fork and checkout this repository,
and then run descriptor
inside the repository folder to install its dependencies:
$ descriptor install
To run this microservice separately, for development, debug, or
testing purposes, use the service scripts in the srv
folder:
-
descriptor-dev.js
: run the development configuration with hard-coded network ports.$ node srv/descriptor-dev.js
This script listens for messages on port 9040 and provides a REPL on port 10040 (try
$ telnet localhost 10040
).A seneca-mesh version, for testing purposes, is also shown in the script
descriptor-dev-mesh.js
. For more on this, see the msr-repl repository. -
descriptor-stage.js
: run the staging configuration. This configuration is intended to run in a Docker container so listens on port 9000 by default, but you can change that by providing an optional argument to the script.$ node srv/descriptor-stage.js [PORT]
-
descriptor-prod.js
: run the production configuration. This configuration is intended to run under Kubernetes in a seneca-mesh network. If running in a terminal (only do this for testing), you'll need to provide the mesh base nodes in theBASES
environment variable.$ BASES=x.x.x.x:port node srv/descriptor-prod.js