Class: Isono::Rack::Job::JobResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/isono/rack/job.rb

Instance Attribute Summary collapse

Attributes inherited from Response

#ctx

Instance Method Summary collapse

Methods inherited from Response

#progress, #responded?

Constructor Details

#initialize(ctx, jobctx) ⇒ JobResponse

Returns a new instance of JobResponse.



13
14
15
16
# File 'lib/isono/rack/job.rb', line 13

def initialize(ctx, jobctx)
  super(ctx)
  @job = jobctx
end

Instance Attribute Details

#jobObject (readonly)

Returns the value of attribute job.



9
10
11
# File 'lib/isono/rack/job.rb', line 9

def job
  @job
end

Instance Method Details

#fail_cb(&blk) ⇒ Object

Register call back which called on the job failure.



19
20
21
# File 'lib/isono/rack/job.rb', line 19

def fail_cb(&blk)
  @job.fail_cb = blk
end

#response(msg) ⇒ Object

Job may run in asynchronous mode. So response() should not raise error even when it is called multiple times during session.



25
26
27
28
29
30
31
# File 'lib/isono/rack/job.rb', line 25

def response(msg)
  if responded?
    Job.logger.info("Defered response message from #{@job.job_id}: #{msg}")
  else
    super(msg)
  end
end