Like many other people, I spend some of my time doing brainless activities like walking, running, commuting. To make this time more enjoyable, I decided to give audible a try. While browsing the available audio books, I found Soft Skills by John Sonmez, which is great since I’ve had this book on my to read list for a while. Since I usually prefer more technical books, I never got around to read it.
This book is about software development, without being about software development. It covers many aspects of a software developer’s life, from career and marketing to finance and fitness.
Framework designers usually make sure there is a way to decouple infrastructure code from business code. Usually this comes in the form of hooks that you can use you to inject custom code. The benefit is twofold: you don’t have duplicated code and you don’t break the Single Responsibility Principle. If you’re using ASP.NET Core/MVC/WebApi, then you have ActionFilters. NServiceBus has its own mechanisms that you can use. In this blog post we’ll discuss two ways of hooking into the message processing pipeline that are useful for managing units of work in NServiceBus : IManageUnitsOfWork and the NServiceBus pipeline. There are many use cases where these prove useful. Here are some examples:
- Manage the unit of work (i.e. the session in NHibernate and RavenDB)
- Logging & Monitoring
- Error Handling
You definitely don’t want to add these concerns to your handlers. Here are two approaches that can help you to keep the handlers clean of infrastructural concerns.