Gem activemessaging 报错

tsinghan · 2014年01月23日 · 最后由 TsingHan 回复于 2014年01月24日 · 4265 次阅读

我在启动 script/poller run 时候,报错,信息如下

=> Unsubscribing from /queue/Test (processed by TestProcessor)
/Users/hanqing/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse': (<unknown>): did not find expected key while parsing a block mapping at line 11 column 5 (Psych::SyntaxError)
    from /Users/hanqing/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:203:in `parse_stream'
    from /Users/hanqing/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:151:in `parse'
    from /Users/hanqing/.rvm/rubies/ruby-1.9.3-p448/lib/ruby/1.9.1/psych.rb:127:in `load'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:369:in `load_connection_configuration'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:124:in `connection'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:399:in `unsubscribe'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:144:in `block in unsubscribe'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:144:in `each'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:144:in `unsubscribe'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:118:in `stop'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:80:in `ensure in start'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging/gateway.rb:81:in `start'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/bundler/gems/activemessaging-35baeebb23a7/lib/activemessaging.rb:130:in `start'
    from /Users/hanqing/hanqing/workspace/pscrm/lib/poller.rb:22:in `<top (required)>'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `load'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/application.rb:203:in `start_load'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/application.rb:294:in `start'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/controller.rb:73:in `run'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons.rb:147:in `block in run'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `call'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons/cmdline.rb:109:in `catch_exceptions'
    from /Users/hanqing/.rvm/gems/ruby-1.9.3-p448@huntor_pscrm/gems/daemons-1.1.9/lib/daemons.rb:146:in `run'
    from script/poller:24:in `<main>'

我的 poller.rb 文件 如下

#!/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

app_root = ENV['APP_ROOT'] || File.expand_path(File.join(File.dirname(__FILE__), '..', '..'))
application_file = File.join(app_root, 'config', 'environment.rb')

if File.exist?(application_file)
  load application_file
else
  raise "#{application_file} does not exist!"
end

Rails.logger = Logger.new(STDOUT)
ActiveMessaging.logger = Rails.logger

# Load ActiveMessaging
ActiveMessaging::load_processors

# Start it up!
ActiveMessaging::start

不知道是哪里导致启动不起来!

感觉像是解析 broker.yml 错误 下面是我的 broker.yml

development:
    ############################
    # Stomp Adapter Properties #
    ############################
    adapter: stomp

    # properties below are all defaults for this adapter
     #login: ""
     #passcode: ""
     host: 192.168.1.5
     port: 61613
     reliable: true
     reconnectDelay: 

问题解决了 折腾了半天 是多了个空格,所以 parse 出错了

需要 登录 后方可回复, 如果你还没有账号请 注册新账号