class Rse::Subscriber

Public Class Methods

new(host: 'rse.home', spshost: 'sps.home') click to toggle source
Calls superclass method
# File lib/rse.rb, line 51
def initialize(host: 'rse.home', spshost: 'sps.home')
  
  @rsc = RSC.new(host)
  super(host: spshost)

end

Public Instance Methods

subscribe(topic: 'rse/ click to toggle source
Calls superclass method
# File lib/rse.rb, line 58
def subscribe(topic: 'rse/#')
  
  super(topic: topic) do |msg, topic|
  
    a = topic.split('/')[1..-1]
    
    if a.length < 2 then
      
      begin
        r = @rsc.run_job(a.first, msg)
      rescue
        self.notice 'rse_result: no job ' + a.first
      end
      
      self.notice 'rse_result: ' + r.inspect
      
    else
      
      package, job = a

      begin
        r = @rsc.run_job(package, job, {}, msg)
      rescue
        self.notice 'rse_result: no job ' + a.first
      end
      
      self.notice "rse_result/%s/%s: %s" % [package, job, r.inspect ]
    end
    
  end
end