Home / .NET / The particular service platform – ServiceMatrix sample and introduction

The particular service platform – ServiceMatrix sample and introduction

In my last post I talked about the particular service platform and how close it is being released. This time I can happily say that it has been released! The particular team did its magic and pushed the whole platform out. You already got a sneak peak at the installation process. This time I will cover ServiceMatrix and show you how easy it is to build a distributed system based on NServiceBus with ServiceMatrix. The sample I will use throughout the blog posts is based on the Hollywood movie Rest in Peace Department.

Slide5

The film was released in 2013 and directed by Robert Schwentke based on the comic book Rest In Peace Department by Peter M. Lenkov. The protagonist Ryan Raynolds as Nick Walker is a detective from the Boston Police Department which gets killed during a raid on a warehouse. After ascending to the limbo in the afterlife Nick is taken into the office of Mildred Proctor / director of the Boston divison of the Rest In Peace Department (R.I.P.D). Proctor explains that R.I.P.D. is an agency that recruits deceased police officers to patrol the afterlife and capture “deados”; spirits that failed to cross over and instead stay on Earth as monsters. Nick agrees to join R.I.P.D. and gets sent back to Earth with his new partner Roy Pulsipher, played by Jeff Bridges. The message flow could look like this

Slide6

When Nick Walker dies an event called “PoliceOfficerDied” (number 1 in the picture above) is published. This gives the R.I.P.D. time to prepare the registration and recruitement process before Nick ascends to heaven. When the soul ascends to afterlife a command “AscendToHeaven”(number 2 in the picture above) is sent. After ascension the R.I.P.D. eventually recruits Nick Walker. When the recruitement process is finished an event “DeadPoliceOfficerRecruited” (number 3 in the picture above) indicates that. Right after the recruitement process Nick gets sent back to earth to hunt the deados left on earth, which is indicated by the command “HuntDeadosOnEarth” (number 4 in the picture above).

Let’s build that crazy sample with ServiceMatrix!

ServiceMatrix1

After the installation of the service platform we have a new project template available in Visual Studio. We can do File>New Project and ServiceMatrix will guide us through in building a distributed system which incorporates some of the best thinking of Udi Dahan. All necessary projects are created, the required nuget packages get downloaded and added to the projects and more happens behind the scene. The following screenshots summarize that process.

ServiceMatrix2

ServiceMatrix3

 

When the solution bootstrapping process is over the ServiceMatrix canvas is loaded inside Visual Studio.

ServiceMatrix4

The main canvas allows to visually design services and endpoints. On the left side of the canvas we see the solution builder which helps to get a quick grasp over all services, endpoints and libraries. On the right side of the canvas we see the usual Solution Explorer from Visual Studio. What you can already see is that ServiceMatrix created the following projects for you automatically.

  • RestInPeaceDepartment.Contracts
  • RestInPeaceDepartment.InternalMessages

On the lower left corner of the canvas we see the Guidance Explorer. The Guidance Explorer is a really powerful feature of ServiceMatrix. It provides living and up to date documentation required to configure NServiceBus in code. For example if you need to know how to disable Second Level Retries just click on the Guidance article and the code is presented to you right inside Visual Studio. Google/Bing is so yesterday ;)

ServiceMatrix5

 

The next post will cover the main canvas and the solution being built in more details.