tirsen / activemessaging

ActiveMessaging is an attempt to bring the simplicity and elegance of Rails development to the world of messaging. Messaging, (or event-driven architecture) is widely used for enterprise integration, with frameworks such as Java's JMS, and products such as ActiveMQ, Tibco, IBM MQSeries etc
0 stars 0 forks source link

Default rails_mode #41

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. There seems to be no default rails_mode
2. This can cause inconsistency among script/poller instances of different
applications

As proposed by delwaterman on Sep 08, 2008
(http://code.google.com/p/activemessaging/wiki/Configuration) poller.rb
should be modified similarly.

#!/usr/bin/env ruby
# Make sure stdout and stderr write out without delay for using with daemon
like scripts
STDOUT.sync = true; STDOUT.flush
STDERR.sync = true; STDERR.flush

unless ENV['RAILS_ENV']
  rails_mode = ARGV.first || "development"
  unless ["development", "test", "production"].include?(rails_mode)
    raise "Unknown rails environment '#{rails_mode}'.  (Choose
'development', 'test' or 'production')"
  end
  ENV['RAILS_ENV'] = rails_mode
end

# Load Rails
RAILS_ROOT=File.expand_path(File.join(File.dirname(__FILE__), '..','..','..'))
load File.join(RAILS_ROOT, 'config', 'environment.rb')

# Load ActiveMessaging processors
ActiveMessaging::load_processors

# Start it up!
ActiveMessaging::start

Original issue reported on code.google.com by Moritz...@gmail.com on 9 Jan 2009 at 11:43