Putting it all together

The main file prepares a microservice deployment environment via a call to the deployServices helper function. The idea here is to string together the services in such a manner so that tracing a request through the system will yield an interesting trace graph. Let's see how this is done.

First, the helper starts three Provider instances and keeps track of their addresses:

Then, it starts an Aggregator instance and sets it up to connect to providers 1 and 2 from the preceding list:

Following that, it instantiates yet another Aggregator type and connects it to provider 0 and the aggregator we just created:

Finally, a Gateway instance is created with the preceding aggregator as its target and returned to the caller:

The Gateway instance that's returned by the deployServices function is used by runMain to trigger the execution of a quote query that marks the beginning of a new request trace:

In the following section, we will be hooking up a tracer implementation to our code so that we can capture and visualize the request traces that our code generates.