[Backgroundrb-devel] writing a module for bdrb workers

Kevin Olsen kevin at yardbarker.com
Tue Apr 29 12:17:05 EDT 2008


I'm working on a suite of workers that all inherit a lot of their core  
functionality from a plugin that i'm writing. the plugin works fine  
when included within my models so the logic there has been tested and  
works correctly. the goal here is to be able to be able to extend a  
suite of bdrb workers that will have their basic transactional logic  
encapsulated in the plugin/module.

I'm thoroughly perplexed and I would love some suggestions on this.


example worker:

class CommentNotificationWorker < BackgrounDRb::MetaWorker
	include  ActionQueue
	
	set_worker_name :comment_notification_worker
	
	def create(args = nil)
	end

end

I'm trying to call it from inside my comment model in an :after_create  
hook like so (where self is an instance of class Comment, and  
enqueue_action is inherited from the ActionQueue module):


MiddleMan.worker(:comment_notification_worker).enqueue_action(self)



I'm consistently generating this error:

vendor/plugins/backgroundrb/server/lib/master_worker.rb:32:in `load':  
undefined class/module Comment (ArgumentError)
	from /Users/kevin/_yardbarker/action_queue_2008/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:32:in `receive_data'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_parser.rb:29:in `call'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_parser.rb:29:in `extract'
	from /Users/kevin/_yardbarker/action_queue_2008/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:31:in `receive_data'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:212:in `read_external_socket'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:204:in `handle_external_messages'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:178:in `handle_read_event'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `each'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `handle_read_event'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:130:in `start_reactor'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `loop'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `start_reactor'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:21:in `run'
	from /Users/kevin/_yardbarker/action_queue_2008/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:166:in `initialize'
	from script/backgroundrb:60:in `new'
	from script/backgroundrb:60

followed by a heap of:

/opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_nbio.rb:25:in `read_data': Packet::DisconnectError  
(Packet::DisconnectError)
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_worker.rb:46:in `handle_internal_messages'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:176:in `handle_read_event'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `each'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:174:in `handle_read_event'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:130:in `start_reactor'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `loop'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_core.rb:124:in `start_reactor'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_worker.rb:20:in `start_worker'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:133:in `fork_and_load'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:96:in `load_workers'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:91:in `each'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:91:in `load_workers'
	from /opt/local/lib/ruby/gems/1.8/gems/packet-0.1.5/lib/packet/ 
packet_master.rb:20:in `run'
	from /Users/kevin/_yardbarker/action_queue_2008/vendor/plugins/ 
backgroundrb/server/lib/master_worker.rb:166:in `initialize'
	from script/backgroundrb:60:in `new'
	from script/backgroundrb:60



any recommendations would be appreciated.




More information about the Backgroundrb-devel mailing list