Class: Karafka::Web::Pro::Commanding::Handlers::Partitions::Commands::Pause

Inherits:
Base
  • Object
show all
Defined in:
lib/karafka/web/pro/commanding/handlers/partitions/commands/pause.rb

Overview

Executes the pause request to pause (or prolong) partition

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Karafka::Web::Pro::Commanding::Handlers::Partitions::Commands::Base

Instance Method Details

#callObject

Triggers pausing of a given topic partition or updates the pause



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/karafka/web/pro/commanding/handlers/partitions/commands/pause.rb', line 21

def call
  # If pause is already there and we don't want to change the way it is, we skip
  if coordinator.pause_tracker.paused? && request[:prevent_override]
    result('prevented')

    return
  end

  duration = request[:duration]
  duration = FOREVER_MS if duration.zero?

  coordinator.pause_tracker.pause(duration)
  client.pause(topic, partition_id, nil, duration)

  result('applied')
end