본문 바로가기
OpenSource/Apache Storm

초 간단 Apache Storm 맛보기(코딩)

by 태하팍 2020. 5. 25.
반응형

이번 포스팅에서는 maven, springframework, java를 사용한다.

이전 시간에 apache storm 클러스터를 셋팅 해보았다.

그에 맞는 storm버전을 maven pom.xml에 작성해보자.
maven관련 내용은 메이븐레파지토리에서 알수 있다.

https://mvnrepository.com/artifact/org.apache.storm/storm-core/1.0.1

 

그리고 로깅과 스프링프레임워크 관련도 셋팅 해보자.

<?xml version="1.0" encoding="UTF-8"?>

<project xmlns="http://maven.apache.org/POM/4.0.0"

         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>

 

    <groupId>storm</groupId>

    <artifactId>game</artifactId>

    <version>1.0-SNAPSHOT</version>

 

    <properties>

        <!-- spring -->

        <spring.version>3.2.13.RELEASE</spring.version>

        <!-- storm -->

        <storm.version>1.0.1</storm.version>

        <httpclient.version>4.5.2</httpclient.version>

 

        <!-- logging -->

        <slf4j.version>1.7.10</slf4j.version>

        <logback.version>1.1.2</logback.version>

    </properties>


    <dependencies>

        <!-- spring -->

        <dependency>

            <groupId>org.springframework</groupId>

            <artifactId>spring-context</artifactId>

            <version>${spring.version}</version>

        </dependency>

        <dependency>

            <groupId>org.springframework</groupId>

            <artifactId>spring-beans</artifactId>

            <version>${spring.version}</version>

        </dependency>

        <dependency>

            <groupId>org.springframework</groupId>

            <artifactId>spring-web</artifactId>

            <version>${spring.version}</version>

        </dependency>

        <dependency>

            <groupId>org.springframework</groupId>

            <artifactId>spring-jdbc</artifactId>

            <version>${spring.version}</version>

        </dependency>

 

        <!-- storm -->

        <dependency>

            <groupId>org.apache.storm</groupId>

            <artifactId>storm-core</artifactId>

            <version>${storm.version}</version>

            <scope>provided</scope>

        </dependency>

        <dependency>

            <groupId>org.apache.storm</groupId>

            <artifactId>flux-core</artifactId>

            <version>${storm.version}</version>

        </dependency>

 

        <!-- Logging -->

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>slf4j-api</artifactId>

            <version>${slf4j.version}</version>

        </dependency>

        <dependency>

            <groupId>ch.qos.logback</groupId>

            <artifactId>logback-core</artifactId>

            <version>${logback.version}</version>

        </dependency>

        <dependency>

            <groupId>ch.qos.logback</groupId>

            <artifactId>logback-classic</artifactId>

            <version>${logback.version}</version>

        </dependency>

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>jcl-over-slf4j</artifactId>

            <version>${slf4j.version}</version>

        </dependency>

        <dependency>

            <groupId>org.slf4j</groupId>

            <artifactId>log4j-over-slf4j</artifactId>

            <version>${slf4j.version}</version>

        </dependency>

 

    </dependencies>

</project>

코드는 2가지를 해보려고 한다.

코드실행은 로컬이 아닌 서버에서 동작한다.

 

코드를 보기전에 용어부터 알아보자.

  • Topology : Spout와 Bolt 들간의 흐름을 제어하는 부분! main 함수도 있다~

 

 

 

HelloWorld Sample : https://bcho.tistory.com/991?category=563141

WordCount Sample : https://gyrfalcon.tistory.com/entry/Apache-Storm-2?category=674613

반응형