Class: Rse::Subscriber
- Inherits:
-
SPSSub
- Object
- SPSSub
- Rse::Subscriber
- Defined in:
- lib/rse.rb
Instance Method Summary collapse
-
#initialize(host: 'rse.home', spshost: 'sps.home') ⇒ Subscriber
constructor
A new instance of Subscriber.
- #subscribe(topic: 'rse/#') ⇒ Object
Constructor Details
#initialize(host: 'rse.home', spshost: 'sps.home') ⇒ Subscriber
Returns a new instance of Subscriber.
51 52 53 54 55 56 |
# File 'lib/rse.rb', line 51 def initialize(host: 'rse.home', spshost: 'sps.home') @rsc = RSC.new(host) super(host: spshost) end |
Instance Method Details
#subscribe(topic: 'rse/#') ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# 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 |