You can use a Mapping node to
retrieve a value from a map in an embedded
cache or a WebSphere® eXtreme
Scale grid.
Before you begin
You must complete the following task:
- Create a graphical data map by using
the Graphical Data Mapping editor. For information, see Creating a message map.
About this task
You can use a Cache Get transform in a Mapping node to retrieve
data from the global cache. To
configure a graphical data map to retrieve
data from the global cache, complete
the following steps:
Procedure
- Open the graphical data map in the Graphical
Data Mapping editor.
- In the toolbar, click the Cache Get icon () to add a Cache Get transform to the
canvas.
When you add a Cache Get transform, you automatically
add a Cache Return transform.
- Provide values for the parameters in the Cache Put transform by completing
one of the following steps:
- Map the input elements to the Cache Get transform.
- Identify fixed values or user-defined
properties to assign to the parameters.
Note: You can also map elements from the input tree to the Cache Return transform and
use these elements to transform the returned cache value.
- Optional: Map the Cache Return transform to
the output element that you want to receive the value that is associated
with the key in the key-value pair.
Note: You can also
select the elements before you click the Cache Get icon. The elements
that you select in the input tree are then automatically mapped to
the Cache Get transform,
and the Cache Return transform
is mapped to the elements that you select in the output tree.
For example, in the following image, the Key element
is mapped to the Cache Get transform,
and the Cache Return transform
is mapped to the Value element.
- Double-click the Cache Get transform to edit
the nested map.
Note: To edit the nested map, you can
also perform any of the following operations:
- Click the Cache Get link
in the Cache Get transform.
- Click the arrow in the upper right corner of the Cache Get transform.
- Place the mouse over the Cache Get transform, and click Click
here in the pop-up window.
The output elements of the nested
map are the predefined parameters that are required to perform the Cache Get transform. If you
mapped elements to the Cache Get transform,
the elements are displayed as input elements in the nested map.
- Required: Provide a value for the Key parameter
of the Cache Get transform
by using one of the following options:
Note: The Cache Get transform is marked
with an error until a value is provided for the Key parameter.
- Map an element from the input tree.
- Set a fixed value for the key by right-clicking the Key parameter
in the Cache Get transform,
clicking Add Assign, and adding the required
value in the Properties pane. For more information about the Assign transform,
see Assign.
- Set a value for the key by using a user-defined
property; see Accessing user-defined properties from a Mapping node.
For example, in the following image, the
content for the Key parameter is provided by
mapping an element that is named Key from the
input tree.
- Optional: Map or assign values to the MapName,
or CacheName and MapName parameters;
for information about valid values for these parameters, see Cache Get.
- Navigate out of the Cache Get transform by clicking
the arrow icon ().
- Double-click the Cache Return transform to
edit the nested map and process the returned value.
If
you mapped the Cache Return transform
to an element from the output tree, the element is displayed in the
nested map.
- Optional: Map the Value element
in the Cache Return to
an element in the output tree.
The predefined Value input
element in the Cache Return nested
mapping has a default schema type of xs:anySimpleType
.
If you know the type of the Java™ object
in the cache, you can map directly to a target element that has the
schema type that matches the Java Object
type; see Schema types that are returned for each supported Java Object type.
If the entry
in the cache might have one of several Java Object
types, you can apply mapping casts to the predefined Value input
element. For more information, see Cache Return.
For example, in the following image, the Value element
in the Cache Return transform
is mapped to the element that is named Value in
the output tree.
- Optional: Right-click the Cache Get transform and select to implement
a nested mapping that is called if the Cache Get transform fails.
For more information, see Handling global cache exceptions in a graphical data map.
Note: You can also add a
Cache Failure transform by placing
the mouse over the
Cache Get transform
and selecting the
Cache Failure icon
(
).
- Save the graphical data map.
Results
You retrieved a value from the global cache.
What to do next
Complete the following tasks:
For more information about the Cache Get transform, see Cache Get.