我正在使用Torquebox构建一个触发器捕获系统,并使用TDD/BDD系统使用Torquespec来管理捕获的trigger队列并对其进行处理。下面是torquebox.rb配置文件和start_spec.rb规范文件的片段
torquebox.rb
TorqueBox.configure do
pool :web, :type => :shared
service TriggerTrapperService do
config do
name 'RTBS triggers trapper service'
end
end
queue '/queues/rtbs_triggers_queue'
endstart_spec.rb
require 'torquespec'
require 'torquebox-core'
require 'spec_helper'
describe "local test" do
deploy <<-END.gsub(/^ {4}/,'')
application:
root: #{File.dirname(__FILE__)}/../app
END
remote_describe "remote test" do
include TorqueBox::Injectors
it "should work" do
some_service = fetch('/queues/rtbs_triggers_queue')
some_service.should.equal? nil
end
end
end我遇到的问题是,当我在远程块中获取队列rtbs_triggers_queue时,它会返回nil,就好像测试环境中的torquebox.rb没有被读取一样,而且我与torquebox.yml也有相同的结果,原因是什么?提前感谢
发布于 2014-01-29 10:25:09
我发现,与其使用fetch,不如使用我们需要使用的指定队列对象
TorqueBox::Messaging::Queue.new('/queues/my_queue')即使这看起来像是我们正在创建一个新队列,但它实际上是获得对在torquebox.rb中声明的队列的引用。
https://stackoverflow.com/questions/17057616
复制相似问题