kafkr 0.10.0 → 0.13.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3a404654568d9f0c4a16e16f2341757b231cefd27e02186a4de5e34e945afe07
4
- data.tar.gz: 3acf9756a6d8ff3f372d595171cb967736430768c6181b7aca9e79f44061bc8f
3
+ metadata.gz: 669818b6d1e72c19fe96e0d9c37cd0688d83613c030beb9a603426a173b0c2b8
4
+ data.tar.gz: 1b79a859b6ba2e38635df3b98c800940673a7b96ff775674eb68c75c6e647658
5
5
  SHA512:
6
- metadata.gz: b7ca82215482129450e112709ed46533be1638d525b433d92d571b188f93d01c787be4a4eb31cad4509d7c96df23850795bf77171972178491c2ed850868a2e0
7
- data.tar.gz: 7bb54ca0f2ac1fdd3a4db32c12f8e90bc70dfd272007b9b17204a177d488788f5c3c4430a2f12920e07c614f92deac0cd8d3b4a007ee4fc12253dea4b0efe447
6
+ metadata.gz: d07a005786bbf2391568c8982fe48f06917036c3f9b054fce2b4930fe92b53204f3b3f912fa8421bc522a60be07aee700e7bddfffe2367fb2ad6eceacb3ed399
7
+ data.tar.gz: ccb59017f9945f40b01e1f6df350f780176e24d9e46196b4a17f8b2dbee94f934f90d1b4af2ae7ed18a7bedd682c993a8d29fcb535423f1d81f813a545edbdb6
data/exe/kafkr-consumer CHANGED
@@ -7,6 +7,7 @@ require "digest"
7
7
  # Accepting command line arguments for host and port
8
8
  host = ARGV[0] || "localhost"
9
9
  port = ARGV[1] || 4000
10
+ timeout = ARGV[2] || 120
10
11
 
11
12
  puts "Running on host: #{host} and port: #{port}"
12
13
 
@@ -33,13 +34,14 @@ def list_registered_handlers
33
34
  end
34
35
  end
35
36
 
36
- def start_consumer(port, host)
37
- puts "Starting consumer on port #{port}!"
37
+ def start_consumer(port, host, timeout)
38
+ puts "Starting consumer on port #{port}! timeout: #{timeout}"
38
39
  $handlers_changed = false
39
40
 
40
41
  Kafkr::Consumer.configure do |config|
41
42
  config.port = port
42
43
  config.host = host
44
+ config.timeout = timeout
43
45
  end
44
46
 
45
47
  unless $handlers_loaded
@@ -95,13 +97,13 @@ end
95
97
 
96
98
  file_checksums = {}
97
99
  monitoring_thread = Thread.new { monitor_handlers(file_checksums) }
98
- start_consumer(port, host) # Pass the port here
100
+ start_consumer(port, host,timeout) # Pass the port here
99
101
 
100
102
  begin
101
103
  loop do
102
104
  if $restart_required
103
105
  stop_consumer
104
- start_consumer(port, host)
106
+ start_consumer(port, host,timeout)
105
107
  $restart_required = false
106
108
  end
107
109
  sleep 1
@@ -18,6 +18,9 @@ module Kafkr
18
18
  def configuration
19
19
  FileUtils.mkdir_p "./.kafkr"
20
20
  @configuration ||= OpenStruct.new
21
+ @configuration.host = ENV.fetch("KAFKR_HOST", "localhost")
22
+ @configuration.port = ENV.fetch("KAFKR_PORT", 2000)
23
+ @configuration.timeout = ENV.fetch("KAFKR_CONSUMER_TIMEOUT", 120)
21
24
  @configuration.suggest_handlers = false
22
25
  @configuration
23
26
  end
@@ -150,7 +153,7 @@ module Kafkr
150
153
  socket = TCPSocket.new(@host, @port)
151
154
  attempt = 0
152
155
 
153
- Timeout.timeout(20) do
156
+ Timeout.timeout(Kafkr::Consumer.configuration.timeout) do
154
157
  sync_uid = send_message.call(message)
155
158
 
156
159
  loop do
data/lib/kafkr/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Kafkr
4
- VERSION = "0.10.0"
4
+ VERSION = "0.13.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kafkr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.10.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Delaney Kuldvee Burke