Class: TopologyLauncher

Inherits:
Object
  • Object
show all
Defined in:
lib/red_storm/topology_launcher.rb

Overview

TopologyLauncher is the application entry point when launching a topology. Basically it will call require on the specified Ruby topology class file path and call its start method

Class Method Summary collapse

Class Method Details

.main(args) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/red_storm/topology_launcher.rb', line 25

def self.main(args)
  unless args.size > 1
    puts("Usage: redstorm local|cluster topology_class_file_name")
    exit(1)
  end

  env = args[0].to_sym
  class_path = args[1]

  launch_path = Dir.pwd
  $:.unshift File.expand_path(launch_path)
  $:.unshift File.expand_path(launch_path + '/lib')

  require "#{class_path}" 

  topology_name = RedStorm::Configuration.topology_class.respond_to?(:topology_name) ? "/#{RedStorm::Configuration.topology_class.topology_name}" : ''
  puts("RedStorm v#{RedStorm::VERSION} starting topology #{RedStorm::Configuration.topology_class.name}#{topology_name} in #{env.to_s} environment")
  RedStorm::Configuration.topology_class.new.start(class_path, env)
end