Class: AtomicSidekiq::UnitOfWork
- Inherits:
-
Object
- Object
- AtomicSidekiq::UnitOfWork
- Defined in:
- lib/atomic_sidekiq/unit_of_work.rb
Instance Attribute Summary collapse
-
#job ⇒ Object
readonly
Returns the value of attribute job.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
- #acknowledge ⇒ Object
-
#initialize(queue = nil, job = nil, in_flight_keymaker:) ⇒ UnitOfWork
constructor
A new instance of UnitOfWork.
- #queue_name ⇒ Object
- #requeue ⇒ Object
Constructor Details
#initialize(queue = nil, job = nil, in_flight_keymaker:) ⇒ UnitOfWork
Returns a new instance of UnitOfWork.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 5 def initialize(queue = nil, job = nil, in_flight_keymaker:) @queue = queue @job = job @acknowledge_op = AtomicOperation::Acknowledge.new( in_flight_keymaker: in_flight_keymaker ) @requeue_op = AtomicOperation::Requeue.new( in_flight_keymaker: in_flight_keymaker ) end |
Instance Attribute Details
#job ⇒ Object (readonly)
Returns the value of attribute job.
3 4 5 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 3 def job @job end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
3 4 5 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 3 def queue @queue end |
Instance Method Details
#acknowledge ⇒ Object
16 17 18 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 16 def acknowledge acknowledge_op.perform(job: job) end |
#queue_name ⇒ Object
20 21 22 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 20 def queue_name queue.sub(/.*queue:/, "") end |
#requeue ⇒ Object
24 25 26 |
# File 'lib/atomic_sidekiq/unit_of_work.rb', line 24 def requeue requeue_op.perform(queue: "queue:#{queue_name}", job: job) end |