#!/usr/bin/env ruby require "jflow" require "optparse" opts = {} OptionParser.new do |opt| opt.on('-f filename') { |o| opts[:file] = o } end.parse! raise "You need to specify a file!" unless opts[:file] 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