In my last post I showed how to deploy endpoints and to subscribe for events. In this post I’ll cover how to send commands and what ServiceMatrix does for you under the hood.
In order to send a command we apply apply almost the same steps as when publishing an event. We create two undeployed components named AscensionManagement (the sender of the command) and RecruitementOffice (the receiver of the command). The command is we want to send is called AscendToHeaven (number 2 in the overview picture).
We then simply deploy the AscenionManagement to the Earth endpoint and the RecruitementOffice to the Heaven endpoint. The final picture looks like the following.
In order to add the necessary properties to the AscendToHeaven command we can directly edit the generated code. Just make sure that the properties are public (not like presented in the screenshot below).
Now we have built a fully operational solution with two endpoints. Everything like endpoint configuration, message mappings etc. gets automatically wired by ServiceMatrix. You can explore the full potential by browsing around in the created solution structure. Everything is nicely organized into a contract assembly which contains the public contracts (events and messages) for all services. Commands which should only be sent inside the service boundary are put into an assembly called InternalMessages by ServiceMatrix automatically.
This is the end of the blog post series about ServiceMatrix. In my point of view ServiceMatrix is a great tool to explore the best thinkings in how to organize your solution to build a robust NServiceBus system. It also helps to better understand message mappings between endpoints. But for me that’s where the usefulness ends. Honestly I’m more the handcrafted code guy. I like to be able to organize my solutions and assemblies the way I need it. I’m neither a big fan of too many partial class definitions. That’s why I use ServiceMatrix only for demos, prototypes and educational purposes. But that’s just my opinion. Try it for yourself and build your own opinion. Happy messaging!
RT @planetgeekch: The particular service platform – Commands and things under the hood #nservicebus http://t.co/KiAgZOZudv