Class: Karafka::Web::Pro::Ui::Controllers::Consumers::CommandingController

Inherits:
BaseController show all
Defined in:
lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb

Overview

Controller responsible for handling requests that should trigger some action on the consumers.

Constant Summary

Constants inherited from Ui::Controllers::BaseController

Ui::Controllers::BaseController::Models

Instance Attribute Summary

Attributes inherited from Ui::Controllers::BaseController

#params, #session

Instance Method Summary collapse

Methods inherited from Ui::Controllers::BaseController

#cache, #initialize

Methods included from Ui::Controllers::Requests::Hookable

included, #run_after_hooks, #run_before_hooks

Constructor Details

This class inherits a constructor from Karafka::Web::Ui::Controllers::BaseController

Instance Method Details

#quiet(process_id) ⇒ Object

Dispatches the quiet request to a given process

Parameters:

  • process_id (String)


35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb', line 35

def quiet(process_id)
  features.commanding!

  request(
    Commanding::Commands::Consumers::Quiet,
    process_id
  )

  redirect(
    :back,
    success: dispatched_to_one(:quiet, process_id)
  )
end

#quiet_allObject

Dispatches the quiet request that should trigger on all consumers



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb', line 67

def quiet_all
  features.commanding!

  request(
    Commanding::Commands::Consumers::Quiet,
    '*'
  )

  redirect(
    :back,
    success: dispatched_to_all(:quiet)
  )
end

#stop(process_id) ⇒ Object

Dispatches the stop request to a given process

Parameters:

  • process_id (String)


52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb', line 52

def stop(process_id)
  features.commanding!

  request(
    Commanding::Commands::Consumers::Stop,
    process_id
  )

  redirect(
    :back,
    success: dispatched_to_one(:stop, process_id)
  )
end

#stop_allObject

Dispatches the stop request that should trigger on all consumers



82
83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb', line 82

def stop_all
  features.commanding!

  request(
    Commanding::Commands::Consumers::Stop,
    '*'
  )

  redirect(
    :back,
    success: dispatched_to_all(:stop)
  )
end

#trace(process_id) ⇒ Object

Dispatches the trace request to a given process

Parameters:

  • process_id (String)


18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/karafka/web/pro/ui/controllers/consumers/commanding_controller.rb', line 18

def trace(process_id)
  features.commanding!

  request(
    Commanding::Commands::Consumers::Trace,
    process_id
  )

  redirect(
    :back,
    success: dispatched_to_one(:trace, process_id)
  )
end