3.9 Example 9: Business-to-Business Messaging Across Heterogeneous Systems
This example demonstrates business-to-business messaging across heterogeneous systems, as described in the Send Message to Queue - Application (section 2.5.3), Transfer Message (section 2.5.5), and Receive a Message from a Queue – Application (section 2.5.6) use cases.
Prerequisites
See the common prerequisites defined in section 3.
The queue exists.
The application is authorized to send messages to the queue.
If a Directory Service is not being used, the application is configured with the address of the queue prior to the send operation.
The receiving application is authorized to receive messages from the queue.
The supply-chain management software and the customer’s server Queue Manager are deployed on the same machine.
The connector application and the messaging gateway Queue Manager are deployed on the same machine.
Initial System State
The client software for the manufacturer's message queuing system is installed on the messaging gateway computer, and then the connector application is installed, which makes the messaging gateway computer a connector server. The connector queue on the messaging gateway computer is created as part of the connector application installation.
The response queue is configured on the customer server to store responses from the manufacturer.
An administrator creates a foreign queue object in the Directory Service, representing the destination queue for messages traveling from the customer's server to the manufacturer.
Final System State
The final state of MSMQ in this example is the same as the initial state.
Sequence of Events
The sequence of events for the business-to-business messaging across heterogeneous systems example is shown in the following diagram.

Figure 27: Sequence diagram for Example 9
The customer's supply-chain management software sends a status report request to the manufacturer's supply-chain management software. The status report request is encapsulated in an MSMQ message, as described in steps 1 through 4 of Example 1: Disconnected Data Entry (section 3.1), along with necessary details such as the destination queue for the message.
The customer's server Queue Manager stores the message in an outgoing queue and looks up the destination queue in the Directory Service using the algorithm specified in [MS-MQDSSM].
Discovering that the destination is a foreign queue, the customer's server Queue Manager computes the route to the foreign queue by calling the GetDirectoryData ([MS-MQBR] section 3.1.5.9) method, providing a DataElementType parameter set to "RoutingLink" and a FilterArray parameter set to no elements, to create a collection of RoutingLink ([MS-MQDMPR] section 3.1.1.8) ADM element instances that belong to the enterprise. In case a site is not reachable, the GetNextHopsForSiteGate ([MS-MQBR] section 3.1.5.3) algorithm is used to get a list of alternate next hops from which the least cost alternate route to the ultimate destination is constructed using Dijkstra's algorithm.
The next hop to get to the foreign queue is the connector queue on the messaging gateway computer, so the customer's server Queue Manager transfers the message to the messaging gateway computer using the Message Queuing (MSMQ): Message Queuing Binary Protocol (MQQB) when network connectivity is available, as described in step 5 of Example 1: Disconnected Data Entry.
The messaging gateway Queue Manager receives the message from the network and stores it in the connector queu.
The connector application receives the message from the connector queue and forwards the message to its final destination in the manufacturer's enterprise. The details of forwarding are specific to the connector application and the manufacturer's message queuing system and are not included in this example.
When the connector application receives a response, it determines where to send it, which in this case is the response queue on the customer server. Again, the details of how the connector application translates a destination expressed in the manufacturer's message queuing system syntax to a destination in MSMQ are specific to the connector application and the manufacturer's message queuing system and are not included in this example.
The connector application uses a local interface to pass the message and associated details, such as the message's destination, to the messaging gateway Queue Manager.
The messaging gateway Queue Manager stores the message in an outgoing queue and transfers it via MQQB to the customer server when network connectivity is available.
The customer's server Queue Manager receives the message from the network and stores it in the destination queue.
The customer's supply-chain management software receives the message and extracts the status report, and the process completes.