redstorm/examples/dsl/ruby_version_topology.rb

40 lines
1.0 KiB
Ruby
Raw Permalink Normal View History

2013-06-18 18:59:12 +00:00
require 'java'
require 'red_storm'
2013-06-18 18:59:12 +00:00
java_import 'java.lang.System'
# this example topology only prints the Ruby version string. No tuple is emitted.
module RedStorm
module Examples
2013-06-17 19:08:09 +00:00
class VersionSpout < DSL::Spout
output_fields :dummy
2013-05-14 20:32:58 +00:00
on_init do
2013-06-17 19:08:09 +00:00
log.info("***************** REDSTORM VERSION=#{VERSION}")
2013-05-14 20:32:58 +00:00
log.info("***************** RUBY_VERSION=#{RUBY_VERSION}")
log.info("***************** JRUBY_VERSION=#{JRUBY_VERSION}")
log.info("***************** RUBY_ENGINE=#{RUBY_ENGINE}")
log.info("***************** RUBY_PLATFORM=#{RUBY_PLATFORM}")
2013-06-18 18:59:12 +00:00
log.info("***************** JAVA VERSION=#{System.properties["java.runtime.version"]}")
2013-05-14 20:32:58 +00:00
end
on_send {}
end
2013-06-17 19:08:09 +00:00
class RubyVersionTopology < DSL::Topology
spout VersionSpout
2012-02-14 21:47:00 +00:00
2013-06-17 19:08:09 +00:00
configure do |env|
2013-07-29 19:07:58 +00:00
max_task_parallelism 1
num_workers 1
2013-06-17 19:08:09 +00:00
debug false
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