delivery_boy 0.2.0 → 0.2.1

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
  SHA1:
3
- metadata.gz: 53868e134ceaddeaafb5f96416b3fe6a44c866dd
4
- data.tar.gz: 3953493bbe3755d81a971b1e62c1a1a7289ad3a9
3
+ metadata.gz: bd11867261e3297b893e7667d3f8d6e168d4aec6
4
+ data.tar.gz: 80c10735314ee3ff0b1c76de9d2e985cd695b4aa
5
5
  SHA512:
6
- metadata.gz: c62591d732bc07cead953039d63a3fb62b00d59bdcc17dd848d859c69efbd8bca5df98c0ad47b9aa29c3fdc44698da0f16913ac5af9cc23309ced52e8e50f627
7
- data.tar.gz: b51fc9e418556e3cdc8da29357d46a949c284d4806f7c4a047d6d424d907e2c7fd60fddbc97b5580e70974000e0620ca575f98e023a232c756a524b7f2040f27
6
+ metadata.gz: 6ec6357a3d625fd8b5b393318e55285e05f0d4315385ca5734a422823ea13a261cc3a148c872cb69eb7fedb88085735acfdb3663c3f7271dca2b51d5dfe5a23e
7
+ data.tar.gz: 6d6f43c21d5c28bafe0b7c897084b74e11a75e41a9002d59d2c716ff3e868f95b55ad62d89a1961516176042d607017b30aff26e4b46838abef44c1be129755d
data/README.md CHANGED
@@ -151,14 +151,18 @@ The maximum number of messages allowed in the buffer before new messages are rej
151
151
 
152
152
  The maximum number of messages allowed in the queue before new messages are rejected. The queue is used to ferry messages from the foreground threads of your application to the background thread that buffers and delivers messages. You typically only want to increase this number if you have a very high throughput of messages and the background thread can't keep up with spikes in throughput.
153
153
 
154
- #### Authentication and authorization
154
+ #### SSL Authentication and authorization
155
155
 
156
- See [ruby-kafka](https://github.com/zendesk/ruby-kafka#security) for more information.
156
+ See [ruby-kafka](https://github.com/zendesk/ruby-kafka#encryption-and-authentication-using-ssl) for more information.
157
157
 
158
158
  ##### `ssl_ca_cert`
159
159
 
160
160
  A PEM encoded CA cert, or an Array of PEM encoded CA certs, to use with an SSL connection.
161
161
 
162
+ ##### `ssl_ca_cert_file_path`
163
+
164
+ The path to a valid SSL certificate authority file.
165
+
162
166
  ##### `ssl_client_cert`
163
167
 
164
168
  A PEM encoded client cert to use with an SSL connection. Must be used in combination with `ssl_client_cert_key`.
@@ -167,6 +171,32 @@ A PEM encoded client cert to use with an SSL connection. Must be used in combina
167
171
 
168
172
  A PEM encoded client cert key to use with an SSL connection. Must be used in combination with `ssl_client_cert`.
169
173
 
174
+ #### SASL Authentication and authorization
175
+
176
+ See [ruby-kafka](https://github.com/zendesk/ruby-kafka#authentication-using-sasl) for more information.
177
+
178
+ Use either `sasl_gssapi_*` _or_ `sasl_plain_*`, not both.
179
+
180
+ ##### `sasl_gssapi_principal`
181
+
182
+ The GSSAPI principal.
183
+
184
+ ##### `sasl_gssapi_keytab`
185
+
186
+ Optional GSSAPI keytab.
187
+
188
+ ##### `sasl_plain_authzid`
189
+
190
+ The authorization identity to use.
191
+
192
+ ##### `sasl_plain_username`
193
+
194
+ The username used to authenticate.
195
+
196
+ ##### `sasl_plain_password`
197
+
198
+ The password used to authenticate.
199
+
170
200
  ### Testing
171
201
 
172
202
  DeliveryBoy provides a test mode out of the box. When this mode is enabled, messages will be stored in memory rather than being sent to Kafka. If you use RSpec, enabling test mode is as easy as adding this to your spec helper:
@@ -202,7 +232,7 @@ end
202
232
 
203
233
  This takes care of clearing messages after each example, as well.
204
234
 
205
- If you're not using RSpec, you can easily replicate the functionality yourself. Call `DeliveryBoy.test_mode` at load time, and make sure that `DeliveryBoy.testing.clear` is called after each test.
235
+ If you're not using RSpec, you can easily replicate the functionality yourself. Call `DeliveryBoy.test_mode!` at load time, and make sure that `DeliveryBoy.testing.clear` is called after each test.
206
236
 
207
237
  ### Instrumentation & monitoring
208
238
 
@@ -0,0 +1,16 @@
1
+ machine:
2
+ pre:
3
+ - curl -sSL https://s3.amazonaws.com/circle-downloads/install-circleci-docker.sh | bash -s -- 1.10.0
4
+ services:
5
+ - docker
6
+ ruby:
7
+ version: 2.4.1
8
+
9
+ dependencies:
10
+ pre:
11
+ - docker -v
12
+ - docker run -p 2181:2181 -p 9092:9092 --env ADVERTISED_HOST=localhost --env ADVERTISED_PORT=9092 -d spotify/kafka
13
+
14
+ test:
15
+ override:
16
+ - bundle exec rspec
@@ -21,7 +21,7 @@ Gem::Specification.new do |spec|
21
21
  spec.require_paths = ["lib"]
22
22
 
23
23
  spec.add_runtime_dependency "ruby-kafka", "~> 0.4"
24
- spec.add_runtime_dependency "king_konf", "~> 0.1.2"
24
+ spec.add_runtime_dependency "king_konf", "~> 0.1.8"
25
25
 
26
26
  spec.add_development_dependency "bundler", "~> 1.15"
27
27
  spec.add_development_dependency "rake", "~> 10.0"
@@ -2,25 +2,51 @@ require "king_konf"
2
2
 
3
3
  module DeliveryBoy
4
4
  class Config < KingKonf::Config
5
- prefix :delivery_boy
5
+ env_prefix :delivery_boy
6
6
 
7
- integer :ack_timeout, default: 5
8
- integer :compression_threshold, default: 1
9
- integer :connect_timeout, default: 10
10
- integer :delivery_interval, default: 10
11
- integer :delivery_threshold, default: 100
7
+ # Basic
8
+ list :brokers, items: :string, sep: ",", default: ["localhost:9092"]
9
+ string :client_id, default: "delivery_boy"
10
+
11
+ # Buffering
12
12
  integer :max_buffer_bytesize, default: 10_000_000
13
13
  integer :max_buffer_size, default: 1000
14
14
  integer :max_queue_size, default: 1000
15
+
16
+ # Network timeouts
17
+ integer :connect_timeout, default: 10
18
+ integer :socket_timeout, default: 30
19
+
20
+ # Delivery
21
+ integer :ack_timeout, default: 5
22
+ integer :delivery_interval, default: 10
23
+ integer :delivery_threshold, default: 100
15
24
  integer :max_retries, default: 2
16
25
  integer :required_acks, default: -1
17
26
  integer :retry_backoff, default: 1
18
- integer :socket_timeout, default: 30
19
- string :client_id, default: "delivery_boy"
27
+
28
+ # Compression
29
+ integer :compression_threshold, default: 1
20
30
  string :compression_codec, default: nil
31
+
32
+ # SSL authentication
21
33
  string :ssl_ca_cert, default: nil
34
+ string :ssl_ca_cert_file_path
22
35
  string :ssl_client_cert, default: nil
23
36
  string :ssl_client_cert_key, default: nil
24
- list :brokers, items: :string, sep: ",", default: ["localhost:9092"]
37
+
38
+ # SASL authentication
39
+ string :sasl_gssapi_principal
40
+ string :sasl_gssapi_keytab
41
+ string :sasl_plain_authzid
42
+ string :sasl_plain_username
43
+ string :sasl_plain_password
44
+
45
+ # Datadog monitoring
46
+ boolean :datadog_enabled
47
+ string :datadog_host
48
+ integer :datadog_port
49
+ string :datadog_namespace
50
+ list :datadog_tags
25
51
  end
26
52
  end
@@ -64,8 +64,14 @@ module DeliveryBoy
64
64
  connect_timeout: config.connect_timeout,
65
65
  socket_timeout: config.socket_timeout,
66
66
  ssl_ca_cert: config.ssl_ca_cert,
67
+ ssl_ca_cert_file_path: config.ssl_ca_cert_file_path,
67
68
  ssl_client_cert: config.ssl_client_cert,
68
69
  ssl_client_cert_key: config.ssl_client_cert_key,
70
+ sasl_gssapi_principal: config.sasl_gssapi_principal,
71
+ sasl_gssapi_keytab: config.sasl_gssapi_keytab,
72
+ sasl_plain_authzid: config.sasl_plain_authzid,
73
+ sasl_plain_username: config.sasl_plain_username,
74
+ sasl_plain_password: config.sasl_plain_password,
69
75
  )
70
76
  end
71
77
 
@@ -1,10 +1,20 @@
1
1
  module DeliveryBoy
2
2
  class Railtie < Rails::Railtie
3
3
  initializer "delivery_boy.load_config" do
4
+ config = DeliveryBoy.config
4
5
  config_file = "config/delivery_boy.yml"
5
6
 
6
7
  if File.exist?(config_file)
7
- DeliveryBoy.config.load_file(config_file, Rails.env)
8
+ config.load_file(config_file, Rails.env)
9
+ end
10
+
11
+ if config.datadog_enabled
12
+ require "kafka/datadog"
13
+
14
+ Kafka::Datadog.host = config.datadog_host if config.datadog_host.present?
15
+ Kafka::Datadog.port = config.datadog_port if config.datadog_port.present?
16
+ Kafka::Datadog.namespace = config.datadog_namespace if config.datadog_namespace.present?
17
+ Kafka::Datadog.tags = config.datadog_tags if config.datadog_tags.present?
8
18
  end
9
19
  end
10
20
  end
@@ -1,3 +1,3 @@
1
1
  module DeliveryBoy
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: delivery_boy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Schierbeck
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-09-18 00:00:00.000000000 Z
11
+ date: 2017-10-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: ruby-kafka
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.1.2
33
+ version: 0.1.8
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.1.2
40
+ version: 0.1.8
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -97,6 +97,7 @@ files:
97
97
  - Rakefile
98
98
  - bin/console
99
99
  - bin/setup
100
+ - circle.yml
100
101
  - delivery_boy.gemspec
101
102
  - examples/async.rb
102
103
  - examples/sync.rb