Skip to content
Sample Storm Topology for stream processing sensor data
Java Shell
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


This is a sample storm topology for stream processing sensor data. In this case, we're applying simple rules to events being generated by a trucking fleet. The goal is to send email alerts to a dispatch center when a threshold of "Un-Safe" events have been generated by a specific truck/driver.


There are three dependencies to building this example:

  1. Java 1.6
  2. Maven
  3. ActiveMQ
  4. storm-jms

Dependencies 1, 2, and 3 can be downloaded and installed respectively. Once they've been installed and you can do a mvn -version from a command prompt, I'll cover how to build and install storm-jms, and then this project.

Building Storm-JMS

I've forked @ptgoetz's storm-jms project, as one addition was needed to build the project. A pull request has been issued and once it has been added, you can build directly from his repo. For now, we'll go ahead and get it from my repo using the commands below:

git clone
cd storm-jms
mvn clean install

Building Storm-Streaming

Now that the storm-jms dependency has been installed, we can build this project. The process is very similar and is as follows:

git clone
cd storm-jms
mvn clean install

Project Explanation

This project uses the following classes to define the topology com.hortonworks.streaming.impl.topologies.TruckEventProcessorTopology. It has one spout, JmsSpout, and one bolt, TruckEventRuleBolt. The TruckEventRuleBolt class receives each Tuple, and processes it using the TruckEventRuleEngine class. The TruckEventRuleEngine class stores each "Un-Safe" event for a driver and sends an email if 5 events have been captured.

Project Configuration

The src/main/resources/ has the following properties:
notification.subject=Unsafe Driving Alerts

The notification.* are related to the emails sent after the event threshold has been reached, and the jms.* configuration properties control the JMS connection and system details. Make sure you edit the before running the project.

Running the Project

To run the project, just use the shell script to compile and execute the project on a stand-alone machine.

Simulating Data

What's a Storm topology without events? Not too exciting. I've created a data simulator that helps with simulating unsafe driving events among other things. You can find it here, and this is the process to get started:

git clone

Edit the src/main/resources/ to point to your ActiveMQ installation, then build and run the project:

mvn clean package
./ 6 -1 com.hortonworks.streaming.impl.domain.transport.Truck com.hortonworks.streaming.impl.collectors.JmsEventCollector
Something went wrong with that request. Please try again.