With the availability of IBM Integration Bus v10 fixpack 2 it is now possible to use simple Graphical data mapping to access Global Cache key-value data.
The global cache is a repository for data that can be efficiently reused. For example, you can use a global cache to store frequently accessed lookup tables, or state correlation information. The cache data can be for used beyond the scope of a specific message flow node, instance of a message flow, integration server, or integration node. The cache facilitates sharing of data across processes (both in the same integration node, and across integration nodes) and eliminates the need for an alternative solution, such as a database. You can use one message flow node to store data in the global cache, then a second node (in the same message flow or a separate flow), can retrieve that data from the global cache.
Prior to IBM Integration Bus v10 fixpack 2 the message flow note that interacted with the global cache had to do so programmatically though use of the Java user-defined extensions API class MbGlobalMap. While this could be invoked from a Mapping node using a Custom Java transform, the development and support would required Java skills.
From IBM Integration Bus v10 fixpack 2 the Graphical Data Map now includes three new transform types:
These transforms allow you to simply visually interact with the global cache to read, write and remove simple type key-value data entries.
The Tutorials Gallery included with the IBM Integration Toolkit, accessible from the Welcome page and from the Help menu, now includes the additional tutorial “(V10.0.0.2) Using a Mapping node to graphically access a Lookup table that is stored in the Global Cache” that has been published in the OT4I GitHub repository “mapping-cache-tutorial”. Note that you must update your installation to v10 fixpack 2 or higher before loading and running this tutorial.
The tutorial demonstrates both retrieving a value from the global cache by using a Cache Get transform and loading key-value pairs using a Cache Put transform. The tutorial shows how the Cache Get can detect if the global cache returned a value for the given key, to enable the flow logic to branch and read a comma separated values, CSV, file from which to load the global cache via the Cache Put transform.
The Cache Get, Put and Remove transforms use nested mappings to allow the full range of transform types to manipulate the input parameters and any return data from the cache operation. All of the transforms have a nested mapping for input, while the return is only automatically provided when adding the Cache Get to a map.
Figure 1. Cache Get Transform
The Cache Get nested mapping allows you to provide values to select the key, and optionally provide a map and cache name to address the value to be retrieved from the global cache.
Figure 2. Cache Get Input
The “Cache Return” nested mapping allows you to apply any transformation to the value retrieved from the global cache and set it in the output of the mapping node. Note that you can test for the existence of the value retrieved to enable conditional processing depending on whether a match was found in the global cache.
Figure 3. Cache Get Return mapping
The Cache transforms also allow you to optionally add a “Cache Failure” nested mapping which can be used to catch and graphically process any exception encountered when performing the cache operation.
Figure 4. Adding optional Cache Failure Mapping
Note that as with the MbGlobalMap Java API the new Graphical Data Map Cache transform interactions with the cache happen outside the message flow transaction, and are committed immediately. If an exception is thrown downstream of the node that interacts with the cache, the cache interactions are not rolled back.
In summary the new capability provided in the Graphical Data Mapping editor allows you to simply exploit the full capability of globally cached key-value data as part of your visual transformation development.