Prerequisites

First of all, you must have a .NET Core 3.1 SDK (Software Development Kit) installed in your computer and I also assumed you are currently running Windows 10 or some Linux with proper environment set.

So where do we start?

First we setup our environment to have a RabbitMQ instance. We create first a docker-compose.yml with the following contents.

Fig. 1: contents of docker-compose.yml
Fig.2: starting the RabbitMQ instance
Fig. 3: token validation flow
Fig. 4: create a solution
Fig. 5: create source folder
Fig. 6: create projects
Fig. 7: add projects to solution file
Fig. 8: add packages and references
Fig.9: the full project structure
Fig. 10: the base contract
Fig. 11: the submit token contract
Fig. 12: the token accepted contract
Fig. 13: the token rejected contract
TFig. 14: changes needed for appsettings
Fig. 15: launchsettings.json for local development
Fig. 16: startup imports
Fig. 17: add Masstransit and health checks to services
Fig. 18: add health checks endpoints
Fig. 19: full startup settings for token gateway api
Fig. 20: token submission view model for controller
Fig. 21: the token controller
Fig. 22: the submit token consumer
Fig. 23: startup of token validation service
Fig. 24: full startup of token validation service
Fig. 25: building and running the app

Conclusion

There are many ways to achieve microservice communication and this is just one of the ways I recently found. The best part of micro services is you can build your service in any language you preferred whether its rust, csharp, golang, elixir, and etc. and it will still communicate on the event bus.

Software Engineer. View my other articles at https://www.vastorigins.com and also guys listen to my podcast about life at https://anchor.fm/vastorigins.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store