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 +4 -4
- data/README.md +33 -3
- data/circle.yml +16 -0
- data/delivery_boy.gemspec +1 -1
- data/lib/delivery_boy/config.rb +35 -9
- data/lib/delivery_boy/instance.rb +6 -0
- data/lib/delivery_boy/railtie.rb +11 -1
- data/lib/delivery_boy/version.rb +1 -1
- metadata +5 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bd11867261e3297b893e7667d3f8d6e168d4aec6
|
4
|
+
data.tar.gz: 80c10735314ee3ff0b1c76de9d2e985cd695b4aa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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#
|
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
|
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
|
|
data/circle.yml
ADDED
@@ -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
|
data/delivery_boy.gemspec
CHANGED
@@ -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.
|
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"
|
data/lib/delivery_boy/config.rb
CHANGED
@@ -2,25 +2,51 @@ require "king_konf"
|
|
2
2
|
|
3
3
|
module DeliveryBoy
|
4
4
|
class Config < KingKonf::Config
|
5
|
-
|
5
|
+
env_prefix :delivery_boy
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
-
|
19
|
-
|
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
|
-
|
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
|
|
data/lib/delivery_boy/railtie.rb
CHANGED
@@ -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
|
-
|
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
|
data/lib/delivery_boy/version.rb
CHANGED
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.
|
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-
|
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.
|
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.
|
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
|