First, clone the GitHub repository for the example from:
> git clone git://github.com/storm-book/examples-ch06-real-life-app.git
Contains the Topology souce code
Has the tests for the Topology
Has the Node.Js WebApp to play with the Topology
. ├── pom.xml ├── src │ ├── main │ │ └── java │ └── test │ └── groovy └── webapp
Installing Redis is very easy:
Download the latest stable version from the Redis website (at the time of this writing, 2.4.14).
Extract the file.
Run make
, followed by make
install
.
This will compile Redis and leave executable files in your PATH so you can start using Redis.
You’ll find more information on the Redis website as well as documentation on commands and design considerations.
Installing Node.js is pretty straightforward. Download the latest Node.js source from http://www.nodejs.org/#download.
At the time of this writing, 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 Node.js on different platforms.
In order to build the example, you should start the redis-server on your machine.
>nohup redis-server &
After that, 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] ------------------------------------------------------------------------ >
Once the redis-server is running and the build is successful, 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 the following:
>node webapp/app.js
Topology and Node.js commands block eachother. Try running them in different terminals.
Type http://localhost:3000/ and start playing with the example!