Class: Textus::Read::Jobs
- Inherits:
-
Object
- Object
- Textus::Read::Jobs
- Extended by:
- Contract::DSL
- Defined in:
- lib/textus/read/jobs.rb
Overview
Inspect and operate the job queue: list ids by state, retry a dead-lettered job, or purge a state. The agent’s window into deferred convergence work.
Instance Method Summary collapse
- #call(state: "ready", action: nil, job_id: nil) ⇒ Object
-
#initialize(container:, call:) ⇒ Jobs
constructor
A new instance of Jobs.
Methods included from Contract::DSL
arg, around, cli, cli_stdin, contract, contract?, summary, surfaces, verb, view
Constructor Details
#initialize(container:, call:) ⇒ Jobs
Returns a new instance of Jobs.
16 17 18 19 |
# File 'lib/textus/read/jobs.rb', line 16 def initialize(container:, call:) @container = container @call = call end |
Instance Method Details
#call(state: "ready", action: nil, job_id: nil) ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/textus/read/jobs.rb', line 21 def call(state: "ready", action: nil, job_id: nil) queue = Textus::Ports::Queue.new(root: @container.root) case action when "retry" then queue.retry_failed(job_id) when "purge" then queue.purge(state) end { "protocol" => Textus::PROTOCOL, "ok" => true, "state" => state, "jobs" => queue.list(state) } end |