Skip to content

Itinerary

Overview

The Itinerary Object sample demonstrates itinerary routing with an object payload.

In itinerary routing, the sender specifies a routing slip of destinations. Each recipient of a message routes the message on to the next destination on the itinerary. Each destination on the itinerary is either a topic or a subscriber (notated as partyId@topic). In order for a recipient to route a message on to the next subscriber, the recipient that is routing the message must also be a publisher (i.e. have send rights to the topic that the subscriber receiving the message has a subscription to).

In this sample, the “Sender” program acts as a publisher. The party’s Id is contained in the program’s App.config file in the XPath “configuration/appSettings” as an “add” element. The key for the “add” element is “esbClientId” and the value is “ContactSender” which is the Id of the party that is being used. “ContactSender” can be found in this sample’s Neuron solution in the Messaging tab under “Publishers”. Similarly, the “Receiver” and “Receiver2” programs act as publishers and subscribers. Their party Ids, which are “ContactReceiver” and “ContactReceiver2”, can be found in the App.config files for their respective programs.

As an alternative to using the App.config file to set the Publisher or Subscriber Id, they can be set programmatically when creating the Publisher or Subscriber object by passing in a string containing the Id of the Publisher or Subscriber to the constructor.

This sample is located in the samples hierarchy at Samples\Patterns\Itinerary.

Running the Sample

Open the Sample

To open this sample, see the topic Using the Neuron Samples and select the Itinerary sample.

Setup Instructions

Before running this sample, follow these instructions:

  1. In the Visual Studio project that opens, add a reference to Neuron.Esb.dll in all three projects.
  2. Configure the solution for multiple startup projects, setting all three projects to Start.
  3. Build the solution.

Run Instructions

  1. In Visual Studio, press F5 to start all three projects.
  2. Once all programs have connected to Neuron ESB, press Enter on the sender to initiate communication.
Initialize Sender
Figure 1: The sender program waiting to send a message
  1. As the sample runs, the sender sends a message to an itinerary with two destinations. The receiver program receives the message first, then passes on an augmented version of the message to receiver2, the next stop on the itinerary.
The first receiver program
Figure 2: The first receiver program after receiving the message
The second receiver program
Figure 3: The second receiver program after receiving the modified contact
Was this article helpful?
Dislike 0
Previous: Request/Reply
Next: Direct Messaging