Class: Karafka::Pro::Processing::SubscriptionGroupsCoordinator

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/karafka/pro/processing/subscription_groups_coordinator.rb

Overview

Uses the jobs queue API to lock (pause) and unlock (resume) operations of a given subscription group. It is abstracted away from jobs queue on this layer because we do not want to introduce jobs queue as a concept to the consumers layer

Instance Method Summary collapse

Instance Method Details

#pause(subscription_group, lock_id = nil) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/karafka/pro/processing/subscription_groups_coordinator.rb', line 19

def pause(subscription_group, lock_id = nil, **)
  jobs_queue.lock_async(
    subscription_group.id,
    lock_id,
    **
  )
end

#resume(subscription_group, lock_id = nil) ⇒ Object



30
31
32
# File 'lib/karafka/pro/processing/subscription_groups_coordinator.rb', line 30

def resume(subscription_group, lock_id = nil)
  jobs_queue.unlock_async(subscription_group.id, lock_id)
end