Chapter 3. Reference Architecture Environment

3.1. Overview

This reference architecture takes advantage of the provided JBoss EAP 7 installer script to establish multiple basic application servers for hosting the HACEP framework and its various components. External to the EAP instances, a JBoss A-MQ cluster is established as the Event Channel, or origin point of those events which will feed the HACEP system. A separate ZooKeeper ensemble is used for LevelDB replication pertaining to the A-MQ cluster.

3.2. JBoss EAP 7.0.1

Red Hat JBoss Enterprise Application Platform 7.0.1, Red Hat’s Java EE-based application server runtime, is utilized as the container for deployment of the HACEP framework. Various capabilities provided by the container are leveraged as part of a HACEP enterprise-level integration, such as Weld Contexts and Dependency Injection, JGroups integration for ease of node clustering and communication, resource adapters for simplified communication with external JMS brokers, and more.

3.3. HACEP Cluster Nodes

The HACEP framework is presented as a series of Maven dependencies, which can be integrated within a new or existing application to facilitate the establishment of a highly-available and scalable Complex Event Processing application or service. While there are various extracurricular modules provided as part of the HACEP source code worth mentioning later, the core parts required for integration consist of the hacep-core, hacep-core-model, and hacep-core-camel modules.

At a high level, the hacep-core module provides the majority of the HACEP code, including various extendable configuration interfaces, data grid cache management & optimization, JGroups clustering orchestration, and BRMS session management.

The hacep-core-model module is responsible for hosting integral POJO definitions used throughout the various modules, such as the Fact object, which is related to rule sessions, and the SessionKey, which correlates to data grid cache indexing.

The hacep-core-camel module serves to configure the coordination point for interacting with the external JMS Event Channel component, consuming events from the origin point and kicking off the HACEP processing of the event input.

3.4. HACEP Core Components

The following technologies serve integral roles within the HACEP framework core code.

3.4.1. JGroups

In order to provide scalability, HACEP core code leverages JGroups for multicast communication between nodes. From a clustering perspective, JGroups provides leadership election among nodes as well as notification of addition and removal of nodes which allows the core code to properly implement fault tolerance and distribution of responsibilities among the various members in the cluster. JGroups is leveraged internally by the data grid for cross-network communication in HACEP’s distributed topology.

3.4.2. Routing

As mentioned previously, camel routes are used as a means of communicating with the Event Channel, serving as the inbound origin point of rule-related events. The core HACEP code establishes a route with a JMS endpoint from which a configurable amount of concurrent consumers will take in events from the channel and relay them to the in-memory data grid.

In cases where nodes are added or taken away from a HACEP cluster, the internal camel configuration allows for pause of route functionality while session node ownership and distribution is dealt with internally before resuming operations.

3.4.3. JBoss BRMS

The HACEP framework was born out of a desire to leverage the complex event processing (CEP) capabilities of the JBoss Business Rule Management System (BRMS) in such a way as to meet the expectations and requirements of enterprise-level applications. While the rules engine itself lends to a rather large breadth of CEP functionality, in and of itself worthy of significant documentation, it offers nothing out-of-the-box which assists in high-availability or scalability. At the heart of HACEP, events from the inbound Event Channel are fed to distributed, replicated, CEP-capable BRMS rules sessions, where they are processed in order to facilitate some decision process defined by rules, typically authored by application developers, business users, or stake owners.

3.4.4. Data Grid

The distributed in-memory key/value data store product is used to facilitate cross-node replication of key objects such as inbound event facts and rule sessions. With HACEP, Infinispan as delivered by JDG is used in a distributed topology with the Grouping API enabled, allowing "ownership" of sessions by HACEP nodes in relation to data affinity. HACEP uses two caches called "event" (for holding facts) and "session" within the grid. The data grid internally uses JGroups for cross-node multicast communication.

3.5. Event Channel Components

The Event Channel origin point used within this reference architecture is comprised of the following technologies.

3.5.1. JBoss A-MQ 6.2.1 Cluster

Currently, HACEP core code only requires that an Event Channel server be JMS-compliant and include the JMSXGroupId attribute on all inbound events. The former ensures assumed Camel routing functionality is possible, while the latter is used for node ownership identification. In this reference architecture, a JBoss A-MQ cluster is used for the Event Channel for both the example applications included in the HACEP source code as well as for the example integration application detailed in later chapters.

In future HACEP versions, optimizations are planned to use A-MQ-based systems exclusively for the Event Channel so that the grouping algorithm used for message delivery can be mated with the one utilized by the internal data grid, making direct delivery of events to relevant nodes possible and furthering data affinity.

3.5.2. ZooKeeper Cluster

The JBoss A-MQ cluster used within this reference architecture relies on a ZooKeeper-based replicated LevelDB Store for master/slave coordination and redundancy. Note that this is only one of various replication strategies provided by A-MQ. Officially as of the time of writing, support within the A-MQ cluster for this specific LevelDB strategy is included as technical preview only, but given that the Event Channel configuration largely stands independently of HACEP core code, the replicated LevelDB store is utilized here as a safe example configuration which can easily be swapped to any of the other provided solutions at the behest of application and environment requirements and consistent with enterprise support.