Class: Emque::Consuming::CommandReceivers::UnixSocket::Handler

Inherits:
Object
  • Object
show all
Includes:
Helpers
Defined in:
lib/emque/consuming/command_receivers/unix_socket.rb

Constant Summary collapse

COMMANDS =
[:configuration, :errors, :restart, :status, :stop]

Instance Method Summary collapse

Constructor Details

#initialize(args:, command:) ⇒ Handler



77
78
79
80
# File 'lib/emque/consuming/command_receivers/unix_socket.rb', line 77

def initialize(args:, command:)
  self.args = args
  self.command = command.to_sym
end

Instance Method Details

#helpObject



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/emque/consuming/command_receivers/unix_socket.rb', line 82

def help
  "\#{app_name} Help\n\n# Information\n\nconfiguration                 # current configuration of the application\nhelp                          # this menu\nstatus                        # current status of the application\n\n# Control\n\nerrors clear                  # reset the error count to 0\nerrors down                   # decrease the acceptable error threshold by 1\nerrors expire_after <seconds> # changes the expiration time for future errors\nerrors up                     # increase the acceptable error threshold by 1\nerrors retry                  # Reprocesses all messages in the error queue\nrestart                       # restart all workers\nstop                          # turn the application off\n-------\n  OUT\nend\n"

#respondObject



105
106
107
108
109
110
111
# File 'lib/emque/consuming/command_receivers/unix_socket.rb', line 105

def respond
  if valid_request?
    method(command).call(*args)
  else
    help
  end
end