redstorm/examples/simple/ruby_version_topology.rb

38 lines
1.1 KiB
Ruby
Raw Normal View History

require 'red_storm'
# this example topology only prints the Ruby version string. No tuple is emitted.
module RedStorm
module Examples
class VersionSpout < RedStorm::SimpleSpout
output_fields :dummy
2013-05-14 20:32:58 +00:00
on_init do
log.info("***************** RUBY_VERSION=#{RUBY_VERSION}")
log.info("***************** JRUBY_VERSION=#{JRUBY_VERSION}")
log.info("***************** VERSION=#{VERSION}")
log.info("***************** RUBY_ENGINE=#{RUBY_ENGINE}")
log.info("***************** RUBY_PLATFORM=#{RUBY_PLATFORM}")
end
on_send {}
end
class RubyVersionTopology < RedStorm::SimpleTopology
spout VersionSpout
configure do |env|
debug true
2012-02-14 21:47:00 +00:00
2012-06-28 17:20:01 +00:00
# force the JRuby version property for this topology. this will only affect remote cluster execution
# for local execution use the --1.8|--1.9 switch when launching
2012-06-28 17:20:01 +00:00
# set "topology.worker.childopts", "-Djruby.compat.version=RUBY1_9"
end
on_submit do |env|
if env == :local
2012-06-28 17:20:01 +00:00
sleep(5)
cluster.shutdown
end
end
end
end
end