< Previous | Next >

Introduction

This sample shows you how to invoke an endpoint dynamically, by retrieving the address from a database at runtime.

This sample provides an alternative implementation to the one described in the Stock Quote sample. The business scenario is the same as the Stock Quote sample, as described below.

A financial services company provides an interactive Web-based stock market service to its customers. The company wants to differentiate itself from its competition by offering tiered levels of service. The company's goal is to offer delayed stock quotes to their standard customers and real-time quotes to their premium customers, that is, customers who pay a subscription.

The company wants to:
  • Offer the delayed and real-time stock quote services by dynamically determining which external service to invoke based on the customer's subscription level.
  • Log all requests to the service to satisfy audit requirements.

In the Stock Quote sample, a Lookup primitive retrieves the customer's subscription level from a database, and a Filter primitive is used to determine the service to invoke based on the subscription level. The service is invoked statically, using the address that is specified in the import's binding, as shown below:
Stock Quote sample annotated request flow

In this sample, a CustomerLookup primitive is also used to retrieve the customer's subscription level, and then another Database Lookup primitive, ServiceAddressLookup, retrieves the service address from a database based on the subscription level. The service is then invoked using the address that is retrieved from the database.

In this scenario, the service address can be changed or replaced at any time in the database without affecting the flow. Subscription levels and their associated endpoints can also be added without changing the mediation flow. The static stock quote is hard coded for two service levels only, and one would have to change the flow in order to accommodate a new service level, or a change in service address.

The picture below illustrates the mediation flow for this sample.
Dynamic endpoint sample annotated request flow

Modules in this tutorial

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.
< Previous | Next >