#!/usr/bin/env ruby require "jflow" require "optparse" ENV['APP_ROOT'] = Dir.pwd puts ENV['APP_ROOT'] opts = {:file => "worker.json"} OptionParser.new do |opt| opt.on('-f filename') { |o| opts[:file] = o } end.parse! configuration = JSON.parse(File.read(opts[:file])) cli = JFlow::Cli.new(configuration) ["INT", "TERM"].each do |signal| Signal.trap(signal) do cli.shutdown_workers end end cli.start_workers