Sha256: 235a3c146e956f9714e9db890f7bb511c023b2cfd886ba75d02978ee8aa00927

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

#!/usr/bin/env ruby
#
# This command is expected to be run in the root of a Rails application which has a Job model class
# and has an initializer to configure JobDispatch.

ROOT_DIR = Dir.pwd
APP_PATH = File.expand_path('config/application.rb', ROOT_DIR)

unless File.exist?('config/job_dispatch.yml')
  $stderr.puts "Configuration file at 'config/job_dispatch.yml' not found."
  exit 1
end

if ENV['BUNDLE_GEMFILE'] || File.exists('Gemfile')
  require 'bundler/setup'
end

require 'job_dispatch'

# boot the rails app so we can access the Rails stored job queue.
require File.expand_path('config/boot.rb', ROOT_DIR)

ENV["RAILS_ENV"] ||= "development"
JobDispatch.load_config_from_yml('config/job_dispatch.yml', ENV["RAILS_ENV"])

# TODO: Find a way to start the dispatcher with only ActiveRecord/Mongoid skipping the rest of rails
# as it uses ~100MB RAM.

require File.expand_path('config/environment.rb', ROOT_DIR)

JobDispatch.logger = Rails.logger

broker = JobDispatch::Broker.new(JobDispatch.config.broker[:bind], JobDispatch.config.signaller[:bind])
broker.run

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
job_dispatch-0.2.0 bin/job-dispatcher
job_dispatch-0.1.0 bin/job-dispatcher
job_dispatch-0.0.2 bin/job-dispatcher
job_dispatch-0.0.1 bin/job-dispatcher