karafka 1.3.5 → 1.3.6

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
  SHA256:
3
- metadata.gz: dc0f99f61db358d26a8e65c677c387a4dc18ada9fb3a0fba91d512408fe6045c
4
- data.tar.gz: 9c5f338634cf431aa8f69b75cc18540a6a223cfb613691a92c4ce4eacb3a8914
3
+ metadata.gz: b4de7fea7ee892f9c83db91dea9e3d16d48d423985477d3f40440bea77907906
4
+ data.tar.gz: ccfe4744b3bb2c19b31032e8f904716116faa50f96a9be19a4e3cdc79364ebe6
5
5
  SHA512:
6
- metadata.gz: 41f1615ac9cf15f9a8fe8b511836399634298a94c6249e9ac09449d82138c5af073e593b127129fa9bf7ed336758b2095372c0fb271a998d7db843e6f8a53a2c
7
- data.tar.gz: cbf4dbfb337cda933e21d9ecd6ffd3f37fbe58b4ced9a0b48a5124837de2b8656ca0caa0a1f94fc5c14c4d6e9c2073e25c94c224571d4a514bab9bb052fed9f2
6
+ metadata.gz: 74dbf97aec22f4e0f5f9a07ac9b0457c09846332c65f548d30e2b0342a2adec4b8542004aa1937012892f3374b39f83f557ef5adecacc40ae538290842165150
7
+ data.tar.gz: fa2072670fe7c17720e593373a4d8222163f4e789c68ec72e4e1f58f4a08688839a0c01e98115db4dfbc5c57d633b0251fe481fc9838362203961c1e4e236159
Binary file
data.tar.gz.sig CHANGED
Binary file
@@ -1,5 +1,9 @@
1
1
  # Karafka framework changelog
2
2
 
3
+ ## 1.3.6 (2020-04-24)
4
+ - #583 - Use Karafka.logger for CLI messages (prikha)
5
+ - #582 - Cannot only define seed brokers in consumer groups
6
+
3
7
  ## 1.3.5 (2020-04-02)
4
8
  - #578 - ThreadError: can't be called from trap context patch
5
9
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- karafka (1.3.5)
4
+ karafka (1.3.6)
5
5
  dry-configurable (~> 0.8)
6
6
  dry-inflector (~> 0.1)
7
7
  dry-monitor (~> 0.3)
@@ -24,7 +24,7 @@ GEM
24
24
  minitest (~> 5.1)
25
25
  tzinfo (~> 1.1)
26
26
  zeitwerk (~> 2.2)
27
- byebug (11.1.1)
27
+ byebug (11.1.3)
28
28
  concurrent-ruby (1.1.6)
29
29
  delivery_boy (1.0.1)
30
30
  king_konf (~> 0.3)
@@ -52,11 +52,11 @@ GEM
52
52
  concurrent-ruby (~> 1.0)
53
53
  dry-core (~> 0.2)
54
54
  dry-equalizer (~> 0.2)
55
- dry-monitor (0.3.1)
55
+ dry-monitor (0.3.2)
56
56
  dry-configurable (~> 0.5)
57
57
  dry-core (~> 0.4)
58
58
  dry-equalizer (~> 0.2)
59
- dry-events (~> 0.1)
59
+ dry-events (~> 0.2)
60
60
  dry-schema (1.5.0)
61
61
  concurrent-ruby (~> 1.0)
62
62
  dry-configurable (~> 0.8, >= 0.8.3)
@@ -79,7 +79,7 @@ GEM
79
79
  dry-equalizer (~> 0.2)
80
80
  dry-initializer (~> 3.0)
81
81
  dry-schema (~> 1.5)
82
- envlogic (1.1.0)
82
+ envlogic (1.1.2)
83
83
  dry-inflector (~> 0.1)
84
84
  factory_bot (5.1.2)
85
85
  activesupport (>= 4.2.0)
data/README.md CHANGED
@@ -2,11 +2,11 @@
2
2
 
3
3
  [![Build Status](https://travis-ci.org/karafka/karafka.svg?branch=master)](https://travis-ci.org/karafka/karafka)
4
4
 
5
- **Note**: Documentation presented here refers to Karafka `1.3.0`.
5
+ **Note**: Documentation presented here refers to Karafka `1.3.x`.
6
6
 
7
7
  If you're upgrading from `1.2.0`, please refer to our [Upgrade Notes article](https://mensfeld.pl/2019/09/karafka-framework-1-3-0-release-notes-ruby-kafka/).
8
8
 
9
- If you are looking for the documentation for Karafka `1.2.*`, it can be found [here](https://github.com/karafka/wiki/tree/1.2).
9
+ If you are looking for the documentation for Karafka `1.2.x`, it can be found [here](https://github.com/karafka/wiki/tree/1.2).
10
10
 
11
11
  ## About Karafka
12
12
 
@@ -47,7 +47,7 @@ end
47
47
  if ENV['KARAFKA_CONSOLE']
48
48
  # Reloads Karafka irb console session
49
49
  def reload!
50
- puts "Reloading...\n"
50
+ Karafka.logger.info "Reloading...\n"
51
51
  Kernel.exec Karafka::Cli::Console.command
52
52
  end
53
53
  end
@@ -11,19 +11,22 @@ module Karafka
11
11
  def call
12
12
  topics.each do |topic|
13
13
  any_topics = !topic.responder&.topics.nil?
14
+ log_messages = []
14
15
 
15
16
  if any_topics
16
- puts "#{topic.name} =>"
17
+ log_messages << "#{topic.name} =>"
17
18
 
18
19
  topic.responder.topics.each_value do |responder_topic|
19
20
  features = []
20
21
  features << (responder_topic.required? ? 'always' : 'conditionally')
21
22
 
22
- print responder_topic.name, "(#{features.join(', ')})"
23
+ log_messages << format(responder_topic.name, "(#{features.join(', ')})")
23
24
  end
24
25
  else
25
- puts "#{topic.name} => (nothing)"
26
+ log_messages << "#{topic.name} => (nothing)"
26
27
  end
28
+
29
+ Karafka.logger.info(log_messages.join("\n"))
27
30
  end
28
31
  end
29
32
 
@@ -34,15 +37,11 @@ module Karafka
34
37
  Karafka::App.consumer_groups.map(&:topics).flatten.sort_by(&:name)
35
38
  end
36
39
 
37
- # Prints a given value with label in a nice way
40
+ # Formats a given value with label in a nice way
38
41
  # @param label [String] label describing value
39
42
  # @param value [String] value that should be printed
40
- def print(label, value)
41
- printf(
42
- "%<label>-25s %<value>s\n",
43
- label: " - #{label}:",
44
- value: value
45
- )
43
+ def format(label, value)
44
+ " - #{label}: #{value}"
46
45
  end
47
46
  end
48
47
  end
@@ -24,7 +24,7 @@ module Karafka
24
24
  "Kafka seed brokers: #{config.kafka.seed_brokers}"
25
25
  ]
26
26
 
27
- puts(info.join("\n"))
27
+ Karafka.logger.info(info.join("\n"))
28
28
  end
29
29
  end
30
30
  end
@@ -14,11 +14,12 @@ module Karafka
14
14
  module ApiAdapter
15
15
  class << self
16
16
  # Builds all the configuration settings for Kafka.new method
17
+ # @param consumer_group [Karafka::Routing::ConsumerGroup] consumer group details
17
18
  # @return [Array<Hash>] Array with all the client arguments including hash with all
18
19
  # the settings required by Kafka.new method
19
20
  # @note We return array, so we can inject any arguments we want, in case of changes in the
20
21
  # raw driver
21
- def client
22
+ def client(consumer_group)
22
23
  # This one is a default that takes all the settings except special
23
24
  # cases defined in the map
24
25
  settings = {
@@ -26,14 +27,17 @@ module Karafka
26
27
  client_id: ::Karafka::App.config.client_id
27
28
  }
28
29
 
29
- kafka_configs.each do |setting_name, setting_value|
30
+ kafka_configs.each_key do |setting_name|
30
31
  # All options for config adapter should be ignored as we're just interested
31
32
  # in what is left, as we want to pass all the options that are "typical"
32
33
  # and not listed in the api_adapter special cases mapping. All the values
33
34
  # from the api_adapter mapping go somewhere else, not to the client directly
34
35
  next if AttributesMap.api_adapter.values.flatten.include?(setting_name)
35
36
 
36
- settings[setting_name] = setting_value
37
+ # Settings for each consumer group are either defined per consumer group or are
38
+ # inherited from the global/general settings level, thus we don't have to fetch them
39
+ # from the kafka settings as they are already on a consumer group level
40
+ settings[setting_name] = consumer_group.public_send(setting_name)
37
41
  end
38
42
 
39
43
  settings_hash = sanitize(settings)
@@ -6,9 +6,11 @@ module Karafka
6
6
  module Builder
7
7
  class << self
8
8
  # Builds a Kafka::Client instance that we use to work with Kafka cluster
9
+ # @param consumer_group [Karafka::Routing::ConsumerGroup] consumer group for which we want
10
+ # to have a new Kafka client
9
11
  # @return [::Kafka::Client] returns a Kafka client
10
- def call
11
- Kafka.new(*ApiAdapter.client)
12
+ def call(consumer_group)
13
+ Kafka.new(*ApiAdapter.client(consumer_group))
12
14
  end
13
15
  end
14
16
  end
@@ -97,7 +97,7 @@ module Karafka
97
97
  def kafka_consumer
98
98
  # @note We don't cache the connection internally because we cache kafka_consumer that uses
99
99
  # kafka client object instance
100
- @kafka_consumer ||= Builder.call.consumer(
100
+ @kafka_consumer ||= Builder.call(consumer_group).consumer(
101
101
  *ApiAdapter.consumer(consumer_group)
102
102
  ).tap do |consumer|
103
103
  consumer_group.topics.each do |topic|
@@ -3,5 +3,5 @@
3
3
  # Main module namespace
4
4
  module Karafka
5
5
  # Current Karafka version
6
- VERSION = '1.3.5'
6
+ VERSION = '1.3.6'
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: karafka
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.3.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maciej Mensfeld
@@ -36,7 +36,7 @@ cert_chain:
36
36
  KJG/fhg1JV5vVDdVy6x+tv5SQ5ctU0feCsVfESi3rE3zRd+nvzE9HcZ5aXeL1UtJ
37
37
  nT5Xrioegu2w1jPyVEgyZgTZC5rvD0nNS5sFNQ==
38
38
  -----END CERTIFICATE-----
39
- date: 2020-04-03 00:00:00.000000000 Z
39
+ date: 2020-04-24 00:00:00.000000000 Z
40
40
  dependencies:
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: dry-configurable
metadata.gz.sig CHANGED
@@ -1,2 +1,3 @@
1
- C��_
2
- '/�.�%���Ƈ�fsS7�� V@���3�M�'��"��ٕ�AĿ���u� �O�}s(�?����8ϰ�Y����'�(�._@�:���p�����[p��~���+쮞������k]l��� .T�C�@)��;�U�X�E� ���`��6�����A2}��̖}�c<vȓ�^HⰬʴ U,����x'*<*"@Vè������ W��E��F|��u-!\�л��BR|��w[�B�$5r��H�����g�c����=S�8��1 xa������H^��(1�;h��>���k��� �>������������G�%�ǟs�<����\��,�d�H�%*���
1
+ ?ϒ�ѩȹ�t�!D2~�}7^zb���IE��= ���%@��u"����>���`���Ӆ�;E@���%��vag�"�&���?3�<_R}�]�M: mf����j�U���l�������؋�4��l3 U���������\Qe������
2
+ ��
3
+ yE)G'!�IJ�|�f-aD�~d$RoU˔�?��ԇ%,r�����ݩ������'-;�����_sS���?�n��ۀ���|��1��*�(�{�t9�,���#�(�h�J8?�pskR6��f����=)�hJT����⭽���d5��]���g�S�s};�/=�Ľȭ:�b�D�i�W�˒�-f� {q{�+?2����w��Cz����%�