cavalle/banksimplistic — Issue #3: config.to_prepare in infrastructure.rb create new driver object
Author: hallgren
Created: 2011-10-26 11:53:03+00:00
State: open

Hi dude.

It seams like the config.to_prepare block in infrastructure.rb is causing me some problem when I run the rake task to subscribe on events from the amqp driver.

config.to_prepare do
Eventwire.driver = Rails.env.test? ? 'InProcess' : 'AMPQ'
end

It run the following code in eventwire.rb

def self.driver=(driver)
klass = Drivers.const_get(driver.to_sym) if driver.respond_to?(:to_sym)
@driver = klass ? klass.new : driver
end

that re-sets the @driver object. I loose the values in the object variable @subscriptions in the driver that the subscriber method already setup.

I made a work around by remove the config.to_prepare block and run the code directly. Works in my case but dont know if it's a solid solution.