Class: Orchestrated::Orchestration
- Defined in:
- lib/orchestrated/orchestration.rb
Defined Under Namespace
Classes: Handler
Class Method Summary collapse
-
.create(value, sym, args, prerequisite) ⇒ Object
Actually creates a completion (wrapper).
Instance Method Summary collapse
Class Method Details
.create(value, sym, args, prerequisite) ⇒ Object
Actually creates a completion (wrapper). Not exactly an orchestration—ssh…
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/orchestrated/orchestration.rb', line 78 def self.create( value, sym, args, prerequisite) # wee! static analysis FTW! raise ArgumentError.new('prerequisite can never be complete') if prerequisite.never_complete? prerequisite.save! OrchestrationCompletion.new.tap do |completion| completion.orchestration = new.tap do |orchestration| orchestration.handler = Handler.new( value, sym, args) orchestration.save! interest = OrchestrationInterest.new.tap do |interest| interest.prerequisite = prerequisite interest.orchestration = orchestration interest.save! end # interest # interest linkage can often change orchestration state so we have to reload here orchestration.reload end # orchestration completion.save! end # completion end |
Instance Method Details
#dequeue ⇒ Object
102 103 104 |
# File 'lib/orchestrated/orchestration.rb', line 102 def dequeue self.delayed_job.destroy end |
#enqueue ⇒ Object
98 99 100 |
# File 'lib/orchestrated/orchestration.rb', line 98 def enqueue self.delayed_job = Delayed::Job.enqueue( MessageDelivery.new( handler.value, handler.sym, handler.args, self.id) ) end |