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

Returns a new instance of 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
  <<-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

#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