exe/kafkr-consumer in kafkr-0.18.0 vs exe/kafkr-consumer in kafkr-0.018.1
- old
+ new
@@ -7,11 +7,11 @@
# Accepting command line arguments for host and port
host = ARGV[0] || "localhost"
port = ARGV[1] || 4000
timeout = ARGV[2] || 300
-puts "Running on host: #{host} and port: #{port}"
+Kafkr.log "Running on host: #{host} and port: #{port}"
$current_consumer = nil
$restart_required = false
$handlers_loaded = false
$handlers_changed = false
@@ -24,20 +24,19 @@
def stop_consumer
$current_consumer = nil if $current_consumer
end
def list_registered_handlers
- puts "Registered Handlers:"
Kafkr::Consumer.handlers.each do |handler|
$loaded_handlers = {}
handler_name = handler.class.name.split("::").last.gsub(/Handler$/, "")
- puts "#{handler_name} handler registered."
+ Kafkr.log "#{handler_name} handler registered."
end
end
def start_consumer(port, host, timeout)
- puts "Starting consumer on port #{port}! timeout: #{timeout}"
+ Kafkr.log "Starting consumer on port #{port}! timeout: #{timeout}"
$handlers_changed = false
Kafkr::Consumer.configure do |config|
config.port = port
config.host = host
@@ -67,10 +66,10 @@
Kafkr::Consumer.load_handlers
new_handlers = Kafkr::Consumer.handlers - handlers_before_reload
if new_handlers.any?
new_handlers.each do |handler|
handler_name = handler.class.name.split("::").last.gsub(/Handler$/, "").capitalize
- puts "#{handler_name} handler updated - ok!"
+ Kafkr.log "#{handler_name} handler updated - ok!"
end
end
end
end