We have seen how to setup NServiceBus but we have not told anything about what NServiceBus in the end is.

The phone call analogy

Phone Icon
  1. Bring up the phone;
  2. Compose a number;
  3. …no answer…;
  4. The phone call failed;
  1. Bring up the phone;
  2. Compose a number;
  3. Start speaking with the called person;
  4. …our really powerful mobile phone infrastructure fails and the call is dropped in the middle;
  5. The phone call failed;

in both cases we have something really similar to what a typical “client to server” communication is:

  • communication is initiated by the client;
  • relies on a live and continuous connection;
  • retries, handling of failures, are responsibility of the client;
  • communication must be synchronous;

The express courier analogy

  1. You order something at your favorite ecommerce web site;
  2. The ordered item gets delivered via UPS;
  3. The UPS delivery guy comes to your delivery address and tries to deliver the item;
  4. The delivery fails because no one is available to receive the package;
  5. The UPS system schedules a new delivery and tries for a fixed number of times;
  6. if in the end the delivery fails the item is returned to the deliverer with, attached, the full delivery report;
spedizioni

In this case we have introduced a third actor, the courier, in order to:

  • Have a reliable delivery;
  • Let someone specialized in the delivery process handle the delivery process;
  • avoid putting in our hand all the details of the retry mechanism;
  • communicate asynchronously;

The service bus

In the end NServiceBus perfectly impersonate the delivery process that an express courier does. Simple, reliable, asynchronous.

nServiceBus_Logo

.m