Messaging Participants


Let’s imagine that I need to send a thank-you letter to my friend Rusty for giving me tickets to a football game last week. Let’s also assume that I will send the letter to Rusty’s office. In real life, it’s probably easier and cheaper to send an e-mail message to Rusty, but that makes for a more complicated example, and sometimes a written letter is simply more appropriate. What sort of steps would I follow to send Rusty the thank-you letter?

As we all know, the order of these steps is open to several variations, but at some point before I send the letter, I have to write the letter. As I am writing the letter, I’ll probably want to reference the football game, as it would be unusual to send a thank-you letter expressing thanks for nothing in particular. Next I would put the letter in an envelope. Then I would write the delivery address on the envelope and place the necessary postage on the envelope. The last step is to drop the letter in any mailbox and let the postal service deliver the letter to Rusty. I am assuming that Rusty will know the letter is from me and that he will know that I appreciated the football tickets.

When we describe messaging participants, it’s often helpful to label them according to the role they play in the message delivery. In general, there are three types of messaging participants: the initial sender, the ultimate receiver, and the intermediaries. In our thank-you letter scenario, I am the initial sender, Rusty is the ultimate receiver, and the mail system and Rusty’s office staff are intermediaries.

Let’s imagine a more real-world business scenario-the order processing system at Contoso Boomerang Corporation. Basically, customers place boomerang orders on the Web site, and the Web site generates an order message and sends it to other internal systems for processing and fulfillment, as shown in Figure 2-1.

image from book
Figure 2-1: Message flow at Contoso Boomerang Corporation

Several facts are implied in this scenario:

  • The Web site and the other internal systems have previously agreed upon the format of the message.

  • The Web site can create the message in the previously agreed upon format.

  • The Web site knows how to send the message to other internal systems.

  • The internal systems can use data in the received message to fill the order, send a confirmation message, and ship the order.

Contoso’s order processing system has at least two messaging participants. The Web site is the initial sender, and the internal systems are the ultimate receivers. It might be the case that we also have a load-balancing messaging router that routes Web site orders to the proper internal system. As shown in Figure 2-2, we can consider this router an intermediary.

image from book
Figure 2-2: Message flow at Contoso Boomerang Corporation with a messaging router

The Initial Sender

Identifying the initial sender can be harder than it looks. In our thank-you letter example, I might appear to be the initial sender. It is plausible, however, to look at my letter as a response to Rusty’s action of sending me the tickets. If we follow this train of thought, Rusty is the initial sender, and I am sending him a thank-you letter as a response to his generosity. Along those same lines, it is also possible that I sent Rusty a letter two months ago asking him for the tickets. In this case, I am the initial sender. Rusty was responding to me when he sent the tickets, and my thank-you message is a response to Rusty’s response. It is also possible that one of our common friends suggested to Rusty that he should send me the tickets. In this case, our common friend is the initial sender.

Our order processing system can display the same ambiguity. At first glance, the Web site might appear to be the initial sender. It might not look that way, however, from the perspective of the internal systems. From that point of view, the initial sender might appear to be either the Web site or another internal system (remember the message router). We could go on an on, but the reality is that the initial sender is relative. By relative, I mean that the initial sender of a message might change based on the context assigned to the message. In both of our examples, we can draw an arbitrary boundary around two or more participants and change the initial sender of the message.

If we drop the initial in initial sender, we have a much more concrete vision of a messaging participant. If we revisit the thank-you letter example, Rusty probably doesn’t care who the initial sender is; he simply needs to know who sent the thank-you letter. In practice, the distinction between the initial sender and just a sender is often not worth determining. For this reason, I will use the term sender instead. If you see the term initial sender in any World Wide Web Consortium (W3C) documents or specifications, be aware of the subtlety embodied in the definition. Given these parameters, the following is how I describe a sender:

A sender is an entity that initiates communication.

Intermediaries

Several people have handled the thank-you letter as it was being delivered to Rusty. To name a few:

  • The postal worker who picked up the letter from the mailbox

  • The postal workers at the sorting facility

  • The postal worker who delivered the mail to Rusty’s office building

  • The mailroom workers at Rusty’s office building who delivered the letter to his office

Through experience, we have come to understand that we don’t know how many people will handle a letter as we send it through the mail. We do expect certain behaviors, however, from those handling our mail. For example, we expect them to not open the mail or materially alter its contents. We also expect that each mail handler will move the letter closer, either in process or in location, to our intended recipient. These message waypoints are called intermediaries. Given these parameters, I define an intermediary as follows:

An intermediary is invisible to the sender and is positioned between the sender and the ultimate recipient.

Identifying intermediaries is also harder than it looks at first glance. In our postal example, isn’t a mail carrier simply picking up a message and sending it forward to another mail carrier? Isn’t the next mail carrier simply picking up a message delivered from another mail carrier and forwarding the message on? Wouldn’t a mail carrier be an initial sender if he or she sends the message forward? It is physically true that each mail carrier handling the letter is sending the letter forward in the process. It is also true that each mail carrier handling the letter receives the letter from either another mail carrier or the sender. Logically, however, the mail carrier might be invisible to the sender and therefore not specifically addressed by the sender. It is also true that mail carriers do not create the message; they are simply handling and delivering the message.

It is also possible, however, that the message envelope will be altered at some point during handling. Think of a postmark. Postmarks do not materially change the contents of the message, but they do provide some information that describes when and where the letter was received into the postal system. The postal service may also add a “Return to Sender” mark on the envelope if the delivery address is not valid. At a high level, these are the types of operations that can be performed by an intermediary. An intermediary should not, however, change the contents of the message.

Let’s reexamine Contoso’s order processing system for a more computer-based example of an intermediary. As it turns out, Contoso sells custom boomerangs and standard boomerangs. Orders for standard boomerangs are processed through Contoso’s inventory system, while custom boomerangs must be sent to the manufacturing system. The system architects at Contoso might have decided to put this logic in a routing system, further encapsulating business logic away from the Web site. The effect of this design is that the Web site sends messages to message routing servers. This routing system might not materially change the contents of the message, but it does route the order to either system. At a high level, the routing system is acting as an intermediary between the initial sender (the Web site) and the ultimate receiver (the inventory or manufacturing systems).

image from book
A Few Words About Business Logic

This additional layer in the architecture can be very useful in capturing a business process. In the past, applications “hard-coded” business processes in their applications. For example, business requirements or regulations might require the Contoso accounting system to receive payment for boomerangs before orders are fulfilled. The traditional distributed system paradigm spreads the logic of this business process between the Web site, the accounting system, and the fulfillment system. This design has a major drawback: when business requirements or regulations evolve, each part of the system requires modification.

In recent years, companies have spent fortunes trying to develop their own internal mechanism for dealing with this problem. Often these efforts involved defining a proprietary XML grammar for expressing business processes and building a custom runtime engine for interpreting these rules. It is my guess that, more often than not, these efforts ended badly.

As mentioned in Chapter 1, “The Moon Is Blue,” Microsoft Windows Communication Foundation (WCF) ships with a product called Windows Workflow Foundation (WF). Among other things, WF is designed to capture these sorts of business processes. WF does much of the heavy lifting previously required to build this sort of business process engine. In the next few years, expect workflow to be more a part of business application development.

image from book

The Ultimate Receiver

My thank-you letter was intended to go to my friend Rusty. When I sent the letter, I had no idea how many people were going to handle it, but I hoped that each handler would work toward delivering the letter to Rusty. As a result, I define the ultimate receiver as follows:

The ultimate receiver is the intended, addressable target of a message.

A single message can have only one logical ultimate receiver. For example, it is not possible to address a postal letter to more than one address. Physically, however, one address could reference multiple entities. For example, if Rusty’s department is responsible for sending the football tickets, I could address the thank-you message to the entire department. My intention in this case is that everyone in the department will receive the message. It is also possible that my message is posted on a bulletin board, sent around to each individual in the department, or announced in a department meeting. In the end, however, the message is intended for one logical entity, the ultimate receiver.




Inside Windows Communication Foundation
Inside Windows Communication Foundation (Pro Developer)
ISBN: 0735623066
EAN: 2147483647
Year: 2007
Pages: 106
Authors: Justin Smith

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net