Class: Workling::Clients::BackgroundjobClient

Inherits:
Base
  • Object
show all
Defined in:
lib/workling/clients/backgroundjob_client.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#close, #connect, load, #logger, #request, #retrieve, #subscribe

Class Method Details

.installed?Boolean

Returns:

  • (Boolean)


5
6
7
# File 'lib/workling/clients/backgroundjob_client.rb', line 5

def self.installed?
  Object.const_defined? "Bj"
end

Instance Method Details

#dispatch(clazz, method, options = {}) ⇒ Object

passes the job to bj by serializing the options to xml and passing them to

./script/bj_invoker.rb, which in turn routes the deserialized args to the
appropriate worker.


12
13
14
15
16
17
18
19
20
21
# File 'lib/workling/clients/backgroundjob_client.rb', line 12

def dispatch(clazz, method, options = {})
  stdin = Workling::Remote.routing.queue_for(clazz, method) + 
          " " + 
          options.to_xml(:indent => 0, :skip_instruct => true)
          
  Bj.submit "./script/runner ./script/bj_invoker.rb", 
    :stdin => stdin
  
  return nil # that means nothing!
end