Enterprise Integration Patterns
Conversation Patterns
HOME PATTERNS RAMBLINGS ARTICLES TALKS DOWNLOAD BOOKS CONTACT
Conversation Patterns
ReferralConversation Patterns » Discovery

A participant wants to initiate a conversation.

The choice of conversation partner may depend on the context of a conversation or may change over time. How can an initiator discover the right conversation partner?

One participant provides a Referral to another, such that the two can start to interact.

The Referral conversation involves the following participants:

The purpose of using a Referral can be to cross trust boundaries. If the Referral trusts the Referrer and the Referrer trusts the Initiator then the Referrer is permitted to pass a Referral to the Initiator to conduct a conversation with the Referral. This is sometimes referred to as the "Mafia approach" where connections are only made by introduction, i,e, Referral.

Consult Directory is a specialized case of Referral, where the sole purpose of the Referrer is to provide references. In the Referral conversation the Referrer can take part in the general conversation and only pass the Referral during certain points in the conversation. Consult Directory also relies on the Referral to be aware of the Referrer to register itself. However, in a Referral this may not be the case.

Like most Discovery conversations, Referral requires addressability, such as URI's, which can be embedded in a message from the Referrer to the Initiator. If trust and security are an concern, the Referrer may also pass additional information, such as a token, along to assure that the conversation between the Initiator and the Referral is legitimate. In such a setup the Referrer protects access to the Referral as in

Example: HTTP 302 and Location Header

The HTTP protocol includes a "302" status code which indicated "FOUND" and can include a location header element in the response to redirect the user agent to another resource. In HTTP/1.0, the 302 code was referred to as "temporary redirect".

A user agent may make the following request:
GET /ramblings HTTP/1.1
Host: www.eaipatterns.com
The Referrer responds with the following HTTP header.
HTTP/1.1 302 Found
Location: /ramblings.html
Subsequently the Initiator issues the following request:
GET /ramblings.html HTTP/1.1
Host: www.eaipatterns.com

Example: Supplier Refers Customer to Shipper

When a customer orders from an on-line supplier, such as Amazon, the supplier often refers the customer to the shipper's service, for example FedEx's or UPS's tracking service. This referral usually includes a token, so that the customer can retrieve the information from the shipper that is associated with his or her order.

Related patterns: Consult Directory, Discovery


Creative Commons Attribution License

You can reuse the following elements under the Creative Commons Attribution license: pattern icon, pattern name, problem and solution statements (in bold), and the sketch. Other portions are protected by copyright.