Apache Ignite as Cache - learn-tibco-cep/tutorials GitHub Wiki

Apache Ignite is natively supported by BusinessEvents applications as the distributed in-memory cache.

As shown in Books.cdd, you can select Apache Ignite as the Cluster Provider, and specify the Ignite discovery URL and listen/communication ports in the CDD.

When the BE application cluster starts by using this CDD file, all BE cache agent nodes will be Ignite server nodes, while BE inference agent nodes will be Ignite client nodes.

Object Management

In the CDD, you may specify which object types to be stored in Ignite server nodes, as well as indexes to be created in the cache to support query operations.

Object Mode

Most BE applications will store only Concepts in the cache. This tutorial configures all Concepts to use Cache Only mode, which will send all concept instances to the cache nodes. Events and Scorecards are configured to use Memory Only mode, which will live in the memory of an inference engine only, but not be stored in the cache.

Indexes

You may specify the primary key of a concept by flagging one or more properties of the concept in the CDD. For example, the concept BookAuthorXref is configured to use the combination of 3 fields, {author_id, book_id, book_version} as its primary key.

If no field is flagged as a primary key, a special field named _extId will be used as the primary key by default.

You may also specify secondary indexes to support query operations. For example, the concept Author is configured to use the default _extId as its primary key, and it creates 2 secondary indexes by using the fields author_id and name respectively.

You may also dynamically create indexes at application runtime by calling the catalog function Cluster.DataGrid.Index() as shown in rule-function onCreateIndex. In principle, this function can be used to create composite indexes containing multiple fields, and to specify whether the indexed values are sorted, which cannot be configured in a CDD file. However, the current version of BE does not work for multi-field composite keys, which may be fixed in a future release.

Start Ignite Server Node

Since it is natively supported by BusinessEvents, you do not need to download or install any Ignite artifacts. You can start an Ignite server node by simply starting a BE cache node, i.e.,

$BE_HOME/bin/be-engine --propFile $BE_HOME/bin/be-engine.tra -n cache-0 -u cache -c Books.cdd Books.ear