Book Image

Learning Storm

By : Ankit Jain, Anand Nalya
Book Image

Learning Storm

By: Ankit Jain, Anand Nalya

Overview of this book

<p>Starting with the very basics of Storm, you will learn how to set up Storm on a single machine and move on to deploying Storm on your cluster. You will understand how Kafka can be integrated with Storm using the Kafka spout.</p> <p>You will then proceed to explore the Trident abstraction tool with Storm to perform stateful stream processing, guaranteeing single message processing in every topology. You will move ahead to learn how to integrate Hadoop with Storm. Next, you will learn how to integrate Storm with other well-known Big Data technologies such as HBase, Redis, and Kafka to realize the full potential of Storm.</p> <p>Finally, you will perform in-depth case studies on Apache log processing and machine learning with a focus on Storm, and through these case studies, you will discover Storm's realm of possibilities.</p>
Table of Contents (16 chapters)
Learning Storm
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Extracting the searched keyword


This section explains how you can extract the searched keyword from the referrer URL. Suppose a referrer URL is https://www.google.co.in/#q=learning+storm. We will pass this referrer URL to our KeywordGenerator class and the output will be learning storm. By extracting the keyword to be searched, we can easily identify the search keyword that users are using to reach our site. Let's perform the following steps to extract the keyword from the referrer URL:

  1. We will create a KeywordGenerator class in the com.learningstorm.stormlogprocessing package. This class contains the logic to generate the keyword from the referrer URL. The following is the source code of the KeywordGenerator class:

    /**
     * This class takes the referrer URL as the input,
     * analyzes the URL and returns the
     * keyword to be searched as the output.
    */
    public class KeywordGenerator {
      public String getKeyword(String referer) {
    
        String[] temp;
        Pattern pat = Pattern.compile("[?&#]q...