Building an Itinerary

On top of creating the various activities, you will also need to build out an itinerary via the RoutingSlipBuilder.

PropertyNotes
Tracking NumberA unique identifier to track this specific route

Adding an Activity

var builder = new RoutingSlipBuilder(NewId.NextGuid());
builder.AddActivity("Name", new Uri("address"), new {
  // args
});
var slip = builder.Build();
ParameterNotes
nameThis is a human readable label for the activity
addressThe address of the endpoint where the activity is listening. Short Addresses are also supported.
argsvalues to be bound to the Args type defined in this activity, not shared

Adding a Variable

var builder = new RoutingSlipBuilder(NewId.NextGuid());
builder.AddVariable("Key", "Value")
var slip = builder.Build();

These values are shared across activities. This is a great way to pass data from one activity to the next.

ParameterNotes
keyThe key to retrieve it from later
valueThe value

Binding Data to Args

When you build a subscription, the Arg instance will be created by binding to data in both the variables and the args payload. Any property on your arg class will first get data from the Variables section, and then overridden by the Arg payload.

Example

public record MyCustomArgs(string Name, int Quantity, string Sku);
PropertyVariable ValueArgument ValueResolved Value
Name"Bob"undefined"Bob"
Quantityundefined123123
Sku"abc""DEF""DEF"

Adding a Subscription

By default routing slip events are published. This can cause issues in mature systems. It is recommended to add a subscription which will configure the events to be sent to the configured endpoint.

var builder = new RoutingSlipBuilder(NewId.NextGuid());
builder.AddSubscription(new Uri("address"), RoutingSlipEvents.All)
var slip = builder.Build();
ParameterNotes
addressWhere should routing slip events be sent
eventsRoutingSlipEvents is a flag enum for selecting desired events