Skip to content

Latest commit

 

History

History
94 lines (62 loc) · 2.8 KB

apCSetupExample.asc

File metadata and controls

94 lines (62 loc) · 2.8 KB

Appendix C: Real Life Example Setup

Cloning the repository

GitHub repository for the example is:

> git clone git://github.com/storm-book/examples-ch06-real-life-app.git

Source Organization

The src/main directory contains the Topology soruce code. The src/test directory has the tests for the Topology The webapps directory has the Node.Js WebApp to play with the Topology.

.
├── pom.xml
├── src
│   ├── main
│   │   └── java
│   └── test
│       └── groovy
└── webapp

Installing Redis

Installing redis is very easy. We just need to follow the next steps:

  • Download the lastest stable version from the redis site (http://redis.io/download) at this moment the lastest version is 2.4.14

  • When we’ve downloaded the version, we should extract it,

  • The next step is to run make followed by make install

This will compile redis and leave executable files in out PATH so we can start using redis.

You’ll find more information on the redis official site, as well as documentation on commands and design considerations.

Installing NodeJS

Installing nodejs is pretty straightforward. Download latest nodejs sources from the official site (http://www.nodejs.org/#download).

At this moment the latest version of NodeJS is 0.6.19. Extract the content of the file and run ./configure, make and make install.

You’ll find more information on the official site, as well as documentation on how to install NodeJS on different platforms.

Building and Testing

In order to build the example you should first start the redis-server in your machine, in order for the tests to run.

>nohup redis-server &

After that, you can run the mvn command to effectively compile and test the application.

>mvn package
...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 32.163s
[INFO] Finished at: Sun Jun 17 18:55:10 GMT-03:00 2012
[INFO] Final Memory: 9M/81M
[INFO] ------------------------------------------------------------------------
>

Running The Topology

Once the redis-server is running and the build is successful you can start the topology running in a LocalCluster.

>java -jar target/storm-analytics-0.0.1-jar-with-dependencies.jar

After the topology is started you can start the Node.JS Web Application by running this:

>node webapp/app.js
Tip
Topology and Node.JS commands will be blocking, we suggest you to run them in different terminals.

Playing With The Example

Type the Web App URL: http://localhost:3000/ and start playing with the example!