aboutsummaryrefslogtreecommitdiff
path: root/wordcount/resources/topology.yaml
blob: 725f3be56c78b1f1beaf57a0eacc8bd70df4433c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# topology definition

# name to be used when submitting. This is what shows up...
# in the Storm UI/storm command-line tool as the topology name
# when submitted to Storm
name: "wordcount"

# Topology configuration
config:
  # Hint for the number of workers to create
  topology.workers: 1

# Spout definitions
spouts:
  - id: "sentence-spout"
    className: "org.apache.storm.flux.wrappers.spouts.FluxShellSpout"
    constructorArgs:
      # Command line
      - ["python", "sentencespout.py"]
      # Output field(s)
      - ["sentence"]
    # parallelism hint
    parallelism: 1

# Bolt definitions
bolts:
  - id: "splitter-bolt"
    className: "org.apache.storm.flux.wrappers.bolts.FluxShellBolt"
    constructorArgs:
      # Command line
      - ["python", "splitbolt.py"]
      # Output field(s)
      - ["word"]
    parallelism: 1

  - id: "counter-bolt"
    className: "org.apache.storm.flux.wrappers.bolts.FluxShellBolt"
    constructorArgs:
      # Command line
      - ["python", "countbolt.py"]
      # Output field(s)
      - ["word","count"]
    parallelism: 1

  # Logging
  - id: "log"
    className: "org.apache.storm.flux.wrappers.bolts.LogInfoBolt"
    parallelism: 1

# Stream definitions
streams:
  - name: "Spout --> Splitter" # name isn't used (placeholder for logging, UI, etc.)
    # The stream emitter
    from: "sentence-spout"
    # The stream consumer
    to: "splitter-bolt"
    # Grouping type
    grouping:
      type: SHUFFLE

  - name: "Splitter -> Counter"
    from: "splitter-bolt"
    to: "counter-bolt"
    grouping:
      type: FIELDS
      # field(s) to group on
      args: ["word"]

  - name: "Counter -> Log"
    from: "counter-bolt"
    to: "log"
    grouping:
      type: SHUFFLE