phobos 1.7.1 → 1.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8f244c641277c9ee85b12ea07250670fba1a0e8c
4
- data.tar.gz: 385b9b4dec2f3991b9a8d1345d1f838c4d1ce04d
3
+ metadata.gz: 9a1be0c7e093c341850150a4fc386bb858a4cb37
4
+ data.tar.gz: 6873ff23a925070291916c4b227a4b139bc44463
5
5
  SHA512:
6
- metadata.gz: e116a595f2d1de1881ff4c24b07b563c1f2798e28cc2af434b057b3b137fdd94b91bf44d767f4d138dd1b5114f2afba324c85b2eb1f8e4aba38173fb222ec9e1
7
- data.tar.gz: 4359fba15e7de514376a5da2ab19c4796523c71155b9ea22a54317edae26c1ec9cfbcfefe5b3a856228aedcd405d1adb369ad21df1b72d8651becb7455aa0242
6
+ metadata.gz: '08520a3dd1a8c53057561853ff1651a710a911128a2ef75ce65bb5f82c501c537317a92d473bdc82b4a2270acbd5c0cfd418397c68db286690b7387636f254bc'
7
+ data.tar.gz: 88ffede29159f84ed85f9b1a9c2efb5bc5a4b39f4b04d37cb2d9c690e828d27236c00dce1ecb365ab58a5e8efd503c2e2854cbb45d0bb074e829b48d37b977ff
@@ -6,6 +6,12 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
6
6
 
7
7
  ## UNRELEASED
8
8
 
9
+ ## [1.7.2] - 2018-05-03
10
+ ### Added
11
+ - Add ability to override session_timeout, heartbeat_interval, offset_retention_time, offset_commit_interval, and offset_commit_threshold per listener
12
+ ### Changed
13
+ - Phobos CLI: Load boot file before configuring (instead of after)
14
+
9
15
  ## [1.7.1] - 2018-02-22
10
16
  ### Fixed
11
17
  - Phobos overwrites ENV['RAILS_ENV'] with incorrect value #71
@@ -114,3 +114,10 @@ listeners:
114
114
  backoff:
115
115
  min_ms: 500
116
116
  max_ms: 10000
117
+ # session_timeout, offset_commit_interval, offset_commit_threshold, offset_retention_time, and heartbeat_interval
118
+ # can be customized per listener if desired
119
+ session_timeout: 30
120
+ offset_commit_interval: 15
121
+ offset_commit_threshold: 5
122
+ offset_retention_time: 172800
123
+ heartbeat_interval: 20
@@ -15,13 +15,13 @@ module Phobos
15
15
  end
16
16
 
17
17
  def execute
18
+ load_boot_file
19
+
18
20
  if config_file
19
21
  validate_config_file!
20
22
  Phobos.configure(config_file)
21
23
  end
22
24
 
23
- load_boot_file
24
-
25
25
  if listeners_file
26
26
  Phobos.add_listeners(listeners_file)
27
27
  end
@@ -12,6 +12,11 @@ module Phobos
12
12
  max_bytes_per_partition
13
13
  backoff
14
14
  delivery
15
+ session_timeout
16
+ offset_commit_interval
17
+ offset_commit_threshold
18
+ heartbeat_interval
19
+ offset_retention_time
15
20
  ).freeze
16
21
 
17
22
  def initialize
@@ -20,7 +20,11 @@ module Phobos
20
20
  max_wait_time: nil, force_encoding: nil,
21
21
  start_from_beginning: true, backoff: nil,
22
22
  delivery: 'batch',
23
- max_bytes_per_partition: DEFAULT_MAX_BYTES_PER_PARTITION)
23
+ max_bytes_per_partition: DEFAULT_MAX_BYTES_PER_PARTITION,
24
+ session_timeout: nil, offset_commit_interval: nil,
25
+ heartbeat_interval: nil, offset_commit_threshold: nil,
26
+ offset_retention_time: nil
27
+ )
24
28
  @id = SecureRandom.hex[0...6]
25
29
  @handler_class = handler
26
30
  @group_id = group_id
@@ -31,8 +35,15 @@ module Phobos
31
35
  start_from_beginning: start_from_beginning,
32
36
  max_bytes_per_partition: max_bytes_per_partition
33
37
  }
38
+ @kafka_consumer_opts = compact(
39
+ session_timeout: session_timeout,
40
+ offset_commit_interval: offset_commit_interval,
41
+ heartbeat_interval: heartbeat_interval,
42
+ offset_retention_time: offset_retention_time,
43
+ offset_commit_threshold: offset_commit_threshold
44
+ )
34
45
  @encoding = Encoding.const_get(force_encoding.to_sym) if force_encoding
35
- @consumer_opts = compact(min_bytes: min_bytes, max_wait_time: max_wait_time)
46
+ @message_processing_opts = compact(min_bytes: min_bytes, max_wait_time: max_wait_time)
36
47
  @kafka_client = Phobos.create_kafka_client
37
48
  @producer_enabled = @handler_class.ancestors.include?(Phobos::Producer)
38
49
  end
@@ -84,7 +95,7 @@ module Phobos
84
95
  end
85
96
 
86
97
  def consume_each_batch
87
- @consumer.each_batch(@consumer_opts) do |batch|
98
+ @consumer.each_batch(@message_processing_opts) do |batch|
88
99
  batch_processor = Phobos::Actions::ProcessBatch.new(
89
100
  listener: self,
90
101
  batch: batch,
@@ -98,7 +109,7 @@ module Phobos
98
109
  end
99
110
 
100
111
  def consume_each_message
101
- @consumer.each_message(@consumer_opts) do |message|
112
+ @consumer.each_message(@message_processing_opts) do |message|
102
113
  message_processor = Phobos::Actions::ProcessMessage.new(
103
114
  listener: self,
104
115
  message: message,
@@ -136,6 +147,7 @@ module Phobos
136
147
 
137
148
  def create_kafka_consumer
138
149
  configs = Phobos.config.consumer_hash.select { |k| KAFKA_CONSUMER_OPTS.include?(k) }
150
+ configs.merge!(@kafka_consumer_opts)
139
151
  @kafka_client.consumer({ group_id: group_id }.merge(configs))
140
152
  end
141
153
 
@@ -1,3 +1,3 @@
1
1
  module Phobos
2
- VERSION = '1.7.1'
2
+ VERSION = '1.7.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: phobos
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.1
4
+ version: 1.7.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Túlio Ornelas
@@ -14,7 +14,7 @@ authors:
14
14
  autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
- date: 2018-02-22 00:00:00.000000000 Z
17
+ date: 2018-05-03 00:00:00.000000000 Z
18
18
  dependencies:
19
19
  - !ruby/object:Gem::Dependency
20
20
  name: bundler