class Emque::Consuming::CommandReceivers::UnixSocket::Handler
Constants
- COMMANDS
Attributes
args[RW]
command[RW]
Public Class Methods
new(args:, command:)
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 77 def initialize(args:, command:) self.args = args self.command = command.to_sym end
Public Instance Methods
help()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 82 def help <<-OUT #{app_name} Help # Information configuration # current configuration of the application help # this menu status # current status of the application # Control errors clear # reset the error count to 0 errors down # decrease the acceptable error threshold by 1 errors expire_after <seconds> # changes the expiration time for future errors errors up # increase the acceptable error threshold by 1 errors retry # Reprocesses all messages in the error queue restart # restart all workers stop # turn the application off ------- OUT end
respond()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 105 def respond if valid_request? method(command).call(*args) else help end end
Private Instance Methods
app_name()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 117 def app_name config.app_name.capitalize end
configuration()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 121 def configuration <<-OUT #{app_name} Config ------- #{config.to_hsh.map { |label, value| "#{label}: #{value.inspect}" }.join("\n")} ------- OUT end
errors(*args)
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 132 def errors(*args) runner.control.errors(*args) == true ? status : help end
restart()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 136 def restart runner.restart_application "The application was successfully restarted" end
status()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 141 def status data = runner.status.to_hsh <<-OUT #{app_name} Status ------- errors: #{data[:errors].map { |attr, val| " #{attr}: #{val}" }.join("\n")} workers: #{data[:workers].map { |topic, settings| " #{topic}: #{settings[:count]}" }.join("\n")} ------- OUT end
stop()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 158 def stop runner.stop end
valid_request?()
click to toggle source
# File lib/emque/consuming/command_receivers/unix_socket.rb, line 162 def valid_request? COMMANDS.include?(command) end