Chapter 6. Replication Examples
Prev |  | Next

## Chapter 6. Replication Examples

JE HA provides three different example programs that illustrate the concepts discussed in this manual. You can find them in your JE distribution in the `<JE HOME>/examples/je/rep/quote` directory, where <JE HOME> is the directory where you installed your JE distribution.

The examples provided for you are each based on a mock stock ticker application which stores stock values in a replicated JE environment. The differences in the three examples have to do with how each example handles requests for database access; in particular, database write requests.

Briefly, each of the examples are:

- StockQuotes: Illustrates the most basic demonstration of a replicated application. It is intended to help you gain an understanding of basic HA concepts. It demonstrates use of the HA APIs to create a replicated environment and issue read and write transactions.

  For this example, no attempt is made to route or forward write requests. Instead, the application blindly attempts any write requests that are made at the node. If the node is in the Replica state, a ReplicaWriteException is raised by the underlying HA code. The example then informs you of the problem by way of rejecting the operation.

- RouterDrivenStockQuotes and HARouter: Illustrates how a software load balancer might be integrated with JE HA, where HARouter plays the role of the load balancer for purposes of the example. It does this by using the Monitor class to direct application requests to the appropriate node. Read-only requests are sent to Replicas, while read-write requests are sent to the replication group's Master.

- UpdateForwardingStockQuotes and SimpleRouter: Illustrates the use of an HA unaware router that load balances read and write requests across the nodes in a replication group. The router is implemented in SimpleRouter, and is meant to illustrate how a load balancer appliance might fit into the JE HA architecture.

  This example is based on RouterDrivenStockQuotes.

Usage of each of these examples is described in the Javadoc page for each example.

Prev |  | Next
Listening for Events | Home | Chapter 7. Administration