Skip to content

Getting started and Examples

Regunath B edited this page Jul 22, 2014 · 47 revisions

This page is a quick introduction to get you started running your first Relay on Aesop. Also has details on more involved examples.

Aesop Examples

The examples that follow explore the various change propagation implementations of Aesop.

Example: Memory Relay in 5 minutes

This is the simplest example and requires no coding effort. Please refer to Maven Dependencies to setup the requisite repository location in your Maven build settings. The sample Memory Relay employs an Event producer that generates a series of events simulating fictitious data change events.

Follow these steps to setup and run your first Memory based Relay:

  • git clone aesop
  • Run mvn clean install in sample-memory-relay directory. This might take a while to download Aesop, Trooper and their dependencies from the various Maven repositories.
  • Start the Relay in sample-memory-relay directory:
java -cp "./target/sample-memory-relay-1.0.7-SNAPSHOT.jar:\
./target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher \ 
./src/main/resources/external/bootstrap.xml
  • A successful start will display a message like below on the console:
*************************************************************************
 Trooper __
      __/  \         Runtime Nature : SERVER
   __/  \__/         Component Container : com.flipkart.aesop.runtime.spring.RelayRuntimeComponentContainer
  /  \__/  \         Startup Time : 2,771 ms
  \__/  \__/         Host Name: Regu.local
     \__/
*************************************************************************
18:28:20.899 [main] INFO  o.t.p.r.i.bootstrap.spring.Bootstrap - ** Trooper Bootstrap complete **
  • Point your browser to http://localhost:9090. You should see the Aesop relays console: Aesop relays console

The next step is to run a Consumer for this Memory based Relay. Do the following:

  • Run mvn clean install in sample-client directory. This might take a while to download Aesop, Trooper and their dependencies from the various Maven repositories.
  • Start the Consumer in sample-client directory:
java -cp "./target/sample-client-1.0.7-SNAPSHOT.jar:\
./target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher \ 
./src/main/resources/external/bootstrap.xml
  • A successful start will display a message like below on the console:
*************************************************************************
 Trooper __
      __/  \         Runtime Nature : SERVER
   __/  \__/         Component Container : com.flipkart.aesop.runtime.spring.ClientRuntimeComponentContainer
  /  \__/  \         Startup Time : 2,278 ms
  \__/  \__/         Host Name: Regu.local
     \__/
*************************************************************************
17:23:46.443 [main] INFO  o.t.p.r.i.bootstrap.spring.Bootstrap - ** Trooper Bootstrap complete **
  • Now refresh the Aesop relays console at http://localhost:9090. You should see the newly registered localhost Consumer and the SCN of last consumed change event. The Metrics link in the dashboard shows live stats for event generation and consumption: Aesop Metrics

More Aesop Examples

This information is for more involved use cases of Aesop - for e.g. sourcing changes from a real database and applying it on downstream data sources.

Example : MySQL Relay

Example : HBase Relay

Refer to HBase change event producer for design and implementation details of the HBase Event Producer. Follow these steps to run the HBase Relay:

  • This examples assumes a running HBase setup. For test purposes, you may install a single node HBase instance.
  • Enable HBase replication and configure the SEP custom replication source. This is done in the standard hbase-site.xml file of the HBase instance. A sample is provided here : Sample hbase-site.xml. Follow instructions in the NGData HBase-SEP demo : HBase SEP setup to configure your HBase cluster and start it.
  • git clone aesop
  • Run mvn clean install in sample-hbase-relay directory. This might take a while to download Aesop, Trooper and their dependencies from the various Maven repositories.
  • Start the Relay in sample-hbase-relay directory:
java -cp "./target/sample-hbase-relay-1.0.7-SNAPSHOT.jar:\
./target/lib/*" org.trpr.platform.runtime.impl.bootstrap.BootstrapLauncher \ 
./src/main/resources/external/bootstrap.xml
  • A successful start will display the startup message on the console, similar to that for the Memory Relay explained earlier in this page. You will also be able to access the Aesop relays console at http://localhost:9090.
  • The next step is to generate some change events. This requires the following steps:
    • Setup schema for the sample HBase table "aesop-person" - this is done by running SchemaSetupMain from the sample-hbase-relay Maven module. It may be run as follows:
java -cp "./target/classes:./target/lib/*" com.flipkart.aesop.relay.hbase.SchemaSetupMain
* Injest data into the sample HBase table through a series of HBase Put/Delete operations -  this is done by running [PersonDataInjesterMain](https://github.com/Flipkart/aesop/blob/master/sample-hbase-relay/src/test/java/com/flipkart/aesop/relay/hbase/PersonDataInjesterMain.java) from the `sample-hbase-relay` Maven module. It may be run as follows: 
java -cp "./target/classes:./target/lib/*" com.flipkart.aesop.relay.hbase.PersonDataInjesterMain
  • The next step is to run a Consumer for this Relay. Follow instructions described earlier on this page to run the sample consumer available in sample-client Maven module. On successfully running the consumer, you can see change propagation metrics reflecting on the Aesop relays console at http://localhost:9090.

Example : Diff Relay