Using centralized routing configuration

Component: FileBasedRouting | Nuget: NServiceBus.FileBasedRouting (Version: 1.x)
This is an experimental project
Target NServiceBus Version: 6.x
Centralized file-based routing is an experimental project hosted on ParticularLabs. Particular Software does not provide any support guarantee for such projects.

The sample demonstrates how to use a file to describe the logical routing topology.


Make sure MSMQ is set up as described in the MSMQ Transport - NServiceBus Configuration section.

Running the project

  1. Start the solution.
  2. The text Press <enter> to send a message should be displayed in the Client's console window.
  3. Hit <enter> several times to send some messages.

Verifying that the sample works correctly

  1. The Sales console display information about accepted orders in round-robin fashion.
  2. The Shipping endpoint displays information that orders were shipped.
  3. The Billing endpoint displays information that orders were billed.

Code walk-through

This sample contains four projects. All these project make use of a shared routing file.

  <endpoint name="Samples.FileBasedRouting.Sales">
      <command type="PlaceOrder, Shared"/>
  <endpoint name="Samples.FileBasedRouting.Billing">
      <event type="OrderAccepted, Shared"/>
  <endpoint name="Samples.FileBasedRouting.Shipping">
      <events assembly="Shared"/>

For the purpose of the sample, the file is stored in the local file system. The routing mechanism based on the contents of the file is enabled by following code:

var transport = endpointConfiguration.UseTransport<LearningTransport>();
var routing = transport.Routing();

Related Articles

Last modified