Top
Interstage Big DataComplex Event Processing Server V1.1.0 User's Guide
FUJITSU Software

5.6.5 Designing a Terracotta Application

If a Terracotta cache is to be referenced in complex event processing rules, consideration must be given to an application for storing initial data in the Terracotta cache. If an existing cache can be used, use an existing Terracotta application.

Refer to the Interstage Terracotta BigMemory Max manuals for information on designing and developing a Terracotta application.

Refer to "5.5.3.1 Terracotta Cache Compatible Formats" for information on the format of the cache to be updated.

Each "HashMap" to be specified in a key and value for a Terracotta cache must be associated as follows:

Example

Example of a Virtual Data Window

create window windowName.vdw:ehcache("CacheA", "key") as (key string, address string);

Example of a program to add entries to a Terracotta cache

import net.sf.ehcache.*;
import java.util.HashMap;

(...)
Cach
eManager cacheManager
= CacheManager.newInstance(Crud.class.getResource("/xxx/ehcache.xml")); ... 1.
Ehc
ache cache = cacheManager.getCache("CacheA"); ... 1.
String keyProperty = "key";
... 2.
String keyValue = "1";
... 2.
HashMap value = new HashMap
(); ... 3.
value.put
(keyProperty, keyValue); ... 3.
value.put("address", "Boston"); ... 3.
cache.
put(new Element(keyValue, value)); ... 4.
(...)
  1. Specify the configuration file of the Terracotta cache (Ehcache) to obtain CacheManager, and obtain the cache to be used by the Virtual Data Window.

  2. Create the key property name and its value to be specified in "keyProperty" of the Virtual Data Window. Here, "key" is set as the "keyProperty".

  3. Create the "java.util.HashMap" object to be stored as the value of the cache. Here, a "java.lang.String" type value is set in the "address" property. Also, ensure that the key property name and its value created in "2." are set in the "HashMap" element.

  4. Add entries to the cache.