Skip to content

Commit

Permalink
rabbitmq tested and working
Browse files Browse the repository at this point in the history
  • Loading branch information
purzelrakete committed Nov 7, 2008
1 parent c3a5db9 commit 9bce1e3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/workling/clients/amqp_client.rb
Expand Up @@ -11,8 +11,9 @@ class AmqpClient < Workling::Clients::Base
# starts the client.
def connect; @amq = MQ.new; end

# disconnect from the queue server
def close; @amq.close; end
# no need for explicit closing. when the event loop
# terminates, the connection is closed anyway.
def close; true; end

# subscribe to a queue
def subscribe(key)
Expand Down
1 change: 1 addition & 0 deletions lib/workling/remote/runners/ampq_runner.rb
Expand Up @@ -20,6 +20,7 @@ def run(clazz, method, options = {})
# neet to connect in here as opposed to the constructor, since the EM loop is
# not available there.
@connected ||= AmpqRunner.client.connect

AmpqRunner.client.request(@@routing.queue_for(clazz, method), options)

return nil
Expand Down
5 changes: 4 additions & 1 deletion lib/workling/remote/runners/starling_runner.rb
Expand Up @@ -20,12 +20,15 @@ class StarlingRunner < Workling::Remote::Runners::Base

def initialize
StarlingRunner.client = Workling::Clients::MemcacheQueueClient.new
StarlingRunner.client.connect
StarlingRunner.routing = Workling::Routing::ClassAndMethodRouting.new
end

# enqueues the job onto Starling.
def run(clazz, method, options = {})

# connecting in here avoids exceptions when running rake tasks etc
@connected ||= StarlingRunner.client.connect

StarlingRunner.client.request(@@routing.queue_for(clazz, method), options)

return nil # empty.
Expand Down

0 comments on commit 9bce1e3

Please sign in to comment.