This script outputs the google search parameters required for search on edocs documentation.
eDocs Home > BEA WebLogic Integration 8.1 Documentation > Solution Samples >Dynamic Transformation and Routing Sample

Dynamic Transformation and Routing Sample

This sample illustrates how to approach the common issues of stateless message routing and transformation.

Note: This sample is provided on dev2dev for your convenience and is not supported by BEA.

What the Sample Does

In this sample, messages are received on a JMS queue, examined for a particular value inside the message payload or headers, transformed, and sent to one of two JMS destinations. The transformation is picked dynamically and is not coded into the application—it is a table configurable at runtime.

The sample uses a Dynamic Transformation control to dynamically pick the XQuery Map to convert the incoming document to region-specific schemas. The Business Process listens on the input queue and dynamically routes the message to outputQ1 and outputQ2.

How the Sample Works

The sample architecture includes the following components, shown in the figure below:

  • JPD/Java Client—Sends a JMS message along with the routing variables. In this example they are "From" and "To"
  • Routing Processor Application—A WLW application that is an implementation of a stateless routing and transformation use case
  • XML Metadata Cache—Contains the mapping between the "From" field and the transformation to be applied. Used as a lookup by the Routing Processor application
  • XQ Repository Application—A WLW application that contains the XQuery definitions created by the user with the XQ Mapper

      Dynamic Transformation and Routing Sample

This sample includes two WebLogic Integration applications:

  • XQ Repository—The XQuery repository application containing the XQueries and Transformation control
  • Routing Processor—Contains one synchronous business process and associated primary artifacts (JMS Event Generator, JMS control, Schema, XMLMetaDataCache, and Dynamic Transformation control)

The Routing Processor extracts the Routing fields available in the JMS Message as properties (From and To) and, based on the From routing field, extracts the transformation to be applied on the incoming message from the XMLMetaDataCache and invokes the Dynamic Transformation control.

After completing the transformation, the Routing processor extracts the JMS Destination to which the transformed message has to be routed from the XML Metadata Cache and applies the properties to dynamically configure the JMS Control.

This sample is based on a fictional company, named Avitek Inc., that sells pharmaceutical products over the internet. Based on the region where the order was received, it applies an area-code specific transformation and routes it to the appropriate destination queue as follows:

  • Receives an XML message on a predefined queue on which it listens
  • The JMS message consists of a JMS property that includes a From field and a "To" field
  • Performs a lookup on the XMLMetadata Cache, which consists of an XML document containing a map between the "From" field and the XQuery to be applied
  • Extracts the XQuery URI to be applied using a transformation
  • Enhances the message received by adding an Order ID—generated by a Java node—to the incoming message
  • Invokes the Dynamic Transformation control with the XQuery to be applied for the area code and converts the incoming XML document to the region-specific format
  • Performs a lookup on the XMLMetaData control to retrieve the destination properties where the message is routed using the "To" field/li>
  • Invokes the Set Dynamic properties of the JMS control to set the destination properties
  • Sends an XML message to the JMS queue via the JMS control

It is a best practice to implement the XQueries in a separate application since this provides the flexibility of dynamically adding new transformations without opening the business application.

For example, to add a new transformation for the "From" field with a value of 100 would require the following changes:

  • Add a new transformation a map (.xq) file in the XQ Repository application
  • Update the XMLCache containing the mapping between the from field and the transformation to be applied to add this entry by updating the XML document and the cache
  • Add a new entry for the to field, if necessary, to the XML cache if a new physical JMS destination is required

The actual business application is not modified. By updating the repository and the cache entries, the business application will dynamically apply new transformations and route to new destinations.

Required Software

This sample requires the following software:

  • WebLogic Integration 8.1, SP4 or later (includes Jython 2.1). You can download WebLogic Integration 8.1 from the download page on dev2dev.
  • WLI Common Utilities, version 2.5. You can download WLI Common Utilities from the download page.
  • WebLogic Server Scripting Tool (WLST) (included with WLI Common Utilities). You can also download WLST from the download page.
  • Note: WLST Offline and WLST Online are available for download and evaluation from BEA's dev2dev site, but have not been formally included in the WebLogic Platform 8.1 product. WLST is supported through BEA newsgroups only, and the utility and APIs are subject to change. BEA intends to formally support this capability in a future release of WebLogic Platform.

Supporting Materials

In addition to providing application code, the sample includes the following items:

  • Instructions and scripts for configuring a BEA WebLogic Integration cluster to support the application
  • Instructions and scripts for deploying the application to an appropriately configured cluster/li>
  • Instructions, guidelines, and caveats for creating and assigning tasks

How to Download

You can download the Dynamic Transformation and Routing sample and WLI Common Utilities from the download page on dev2dev.