WebSphere WebSphere Enterprise Service Bus, Version 6.0 Operating Systems: AIX, HP-UX, Linux, Solaris, Windows

Database Lookup mediation primitive

Use the Database Lookup mediation primitive to modify a message, using information from a database.

Introduction

The Database Lookup mediation primitive can add to, or change, messages. It does this using information from a user-supplied database.

This mediation primitive looks up values from a database and stores them as elements in the message. The information obtained from the database might need converting to the correct type to be stored in the message. This is specified using the Message value type property. If the information obtained from the database cannot be converted into the type expected by the message, then an exception occurs.

If a message element already exists in the message then the old value is overwritten with the new value. If the new value is not compatible with the element type defined by property Message value type, then an exception occurs.

The Database Lookup mediation primitive needs various database information, including a key. The key is found using a property called Key path. If the Key path key does not exist in the input message, then an exception occurs.

The Database Lookup mediation primitive has one input terminal and three output terminals. The input terminal is wired to accept a message and the output terminals are wired to propagate a message. One output terminal is used if the Key path key is located both in the message and the database. In this case, the information obtained from the database is stored in the message and the updated message is propagated. Another output terminal is used if the Key path key is found in the message but not in the database. In this case, the original message is propagated unchanged. The last output terminal is used for failure output. If an exception occurs during the processing of the input message, then the fail terminal propagates the original message, together with any exception information.

Usage

You can use the Database Lookup mediation primitive to ensure information in a message is up-to-date.

You can use the Database Lookup mediation primitive to add information to a message, using a key contained in a message. For example, the key could be an account number.

It is often useful to combine the Database Lookup mediation primitive with other mediation primitives. For example, you might use an XSLT mediation primitive to manipulate data, before or after the Database Lookup is invoked.

Properties

Data source name
The JNDI name of the datasource.
Table name
The name of the database table, including the schema name. For example, myschema.mytable.
Key column name
The name of the database's primary key column. The specified key column must contain a unique value; multi-column database keys are not supported. In addition, the unique value must be of the same element type as the value located in the message using the Key path.
Key path
An XPath 1.0 expression. The value returned from the XPath expression is used as the key into the database.
Data elements
A table containing three kinds of properties. These three properties describe where to find the database information, the type of information it is, and whereabouts in the message to store the information.
Value column name
The name of the database column from which to obtain the element value.
Message value type
The type of the element value. The only supported types are Java primitive types or String. At runtime, the value obtained from the database is converted to the type defined by Message value type. Message value type is defined using a String.
Message element
An XPath 1.0 expression describing the path location of a message element. The message element is where the database value is stored. The XPath expression must evaluate to a single element in the message.
Validate input
If true, causes the input message to be validated before the mediation is performed.
Table 1. Database Lookup mediation primitive properties
Property Valid Values Default
Data source name String  
Table name String:  
Key column name String  
Key path String  
Data elements Value column name String  
Message value type String: defining Java primitive or Java String  
Message element String: an XPath expression describing the path location of a message element  
Validate input Boolean: true or false false

Considerations

Consider the following when using the Database Lookup mediation primitive:


Reference topic

Terms of Use |

Last updated: 20 Nov 2005
http://publib.boulder.ibm.com/infocenter/ws60help/index.jsp?topic=/com.ibm.wbit.help.medprim.doc\ref\rwesb_DatabaseLookupmediationprimitive.html

© Copyright IBM Corporation 2005. All Rights Reserved.
This information center is powered by Eclipse technology. (http://www.eclipse.org)