Building an Itinerary
On top of creating the various activities, you will also need to build out an itinerary via the RoutingSlipBuilder.
Property
Notes
Tracking Number
A 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 ();
Parameter
Notes
name
This is a human readable label for the activity
address
The address of the endpoint where the activity is listening. Short Addresses are also supported.
args
values 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.
Parameter
Notes
key
The key to retrieve it from later
value
The 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 );
Property
Variable Value
Argument Value
Resolved Value
Name
"Bob"
undefined
"Bob"
Quantity
undefined
123
123
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 ();
Parameter
Notes
address
Where should routing slip events be sent
events
RoutingSlipEvents is a flag enum for selecting desired events