waterdrop 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f2ef3d3916d6b0e59c191c8a81ad88cc33424a4ee4ff4c7c12e65e5ad3c79ba3
4
+ data.tar.gz: 1e02c7ae97e7c85e1d4aa12fe5e7c2b5611add6d41b15949fc17830382e4d99d
5
+ SHA512:
6
+ metadata.gz: c58aaaec32bbe3c1a930a0366447e5f69e3551619ad48ea243787b1fa487fdb3f17b5e17fd409ef956b0793dba3550a914ac15015e93cd4d81fa992f59040f7e
7
+ data.tar.gz: 00f6e291c053a46c650936a7d0e03a1c20f7631d5b597df30aa1b0f2ae614873b16c8bdf58a7081f3438e894d3f20c006e736826b2adf76e12c2be49e8f42b48
Binary file
Binary file
@@ -0,0 +1,3 @@
1
+ repository_id: '76b3a28c-d72b-44c7-870b-e5217e2f0d5c'
2
+ api_key: <%= ENV['CODITSU_API_KEY'] %>
3
+ api_secret: <%= ENV['CODITSU_API_SECRET'] %>
@@ -0,0 +1 @@
1
+ open_collective: karafka
@@ -0,0 +1,68 @@
1
+ # bundler state
2
+ /.bundle
3
+ /vendor/bundle/
4
+ /vendor/ruby/
5
+ /ruby/
6
+ app.god
7
+
8
+ # minimal Rails specific artifacts
9
+ db/*.sqlite3
10
+ /log/*.log
11
+ /tmp/*
12
+ *.gem
13
+ *.~
14
+ /.coditsu/local.yml
15
+
16
+ # various artifacts
17
+ **.war
18
+ *.rbc
19
+ *.sassc
20
+ .redcar/
21
+ .capistrano/
22
+ .sass-cache
23
+ /config/god/sidekiq.rb
24
+ /config/puma.rb
25
+ /coverage.data
26
+ /coverage/
27
+ /doc/api/
28
+ /doc/app/
29
+ /doc/yard
30
+ /doc/features.html
31
+ /doc/specs.html
32
+ /spec/tmp/*
33
+ /cache
34
+ /capybara*
35
+ /capybara-*.html
36
+ /gems
37
+ /specifications
38
+ rerun.txt
39
+ pickle-email-*.html
40
+
41
+ # If you find yourself ignoring temporary files generated by your text editor
42
+ # or operating system, you probably want to add a global ignore instead:
43
+ # git config --global core.excludesfile ~/.gitignore_global
44
+ #
45
+ # Here are some files you may want to ignore globally:
46
+
47
+ # scm revert files
48
+ **.orig
49
+
50
+ # Mac finder artifacts
51
+ .DS_Store
52
+
53
+ # Netbeans project directory
54
+ /nbproject
55
+
56
+ # RubyMine project files
57
+ .idea
58
+
59
+ # Textmate project files
60
+ /*.tmproj
61
+
62
+ # vim artifacts
63
+ **.swp
64
+
65
+ # documentation
66
+ .yardoc
67
+
68
+ .byebug_history
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --require spec_helper
@@ -0,0 +1 @@
1
+ waterdrop
@@ -0,0 +1 @@
1
+ 2.7.1
@@ -0,0 +1,35 @@
1
+ services:
2
+ - docker
3
+
4
+ dist: trusty
5
+ cache: bundler
6
+
7
+ git:
8
+ depth: false
9
+
10
+ test: &test
11
+ stage: Test
12
+ language: ruby
13
+ before_install:
14
+ - yes | gem update --system
15
+ script: bundle exec rspec
16
+
17
+ jobs:
18
+ include:
19
+ - <<: *test
20
+ rvm: 2.7.1
21
+ - <<: *test
22
+ rvm: 2.6.6
23
+ - <<: *test
24
+ rvm: 2.5.8
25
+
26
+ - stage: coditsu
27
+ language: ruby
28
+ rvm: 2.7.1
29
+ before_install:
30
+ - yes | gem update --system
31
+ script: \curl -sSL https://api.coditsu.io/run/ci | bash
32
+
33
+ stages:
34
+ - test
35
+ - coditsu
@@ -0,0 +1,158 @@
1
+ # WaterDrop changelog
2
+
3
+ ## 1.4.0 (2020-08-25)
4
+ - Release to match Karafka 1.4 versioning.
5
+
6
+ ## 1.3.4 (2020-02-17)
7
+ - Support for new `dry-configurable`
8
+
9
+ ## 1.3.3 (2019-01-06)
10
+ - #119 - Support exactly once delivery and transactional messaging (kylekthompson)
11
+ - #119 - Support delivery_boy 1.0 (kylekthompson)
12
+
13
+ ## 1.3.2 (2019-26-12)
14
+ - Ruby 2.7.0 support
15
+ - Fix missing `delegate` dependency on `ruby-kafka`
16
+
17
+ ## 1.3.1 (2019-10-21)
18
+ - Ruby 2.6.5 support
19
+ - Expose setting to optionally verify hostname on ssl certs #109 (tabdollahi)
20
+
21
+ ## 1.3.0 (2019-09-09)
22
+ - Drop Ruby 2.4 support
23
+
24
+ ## 1.3.0.rc1 (2019-07-31)
25
+ - Drop Ruby 2.3 support
26
+ - Drop support for Kafka 0.10 in favor of native support for Kafka 0.11.
27
+ - Ruby 2.6.3 support
28
+ - Support message headers
29
+ - `sasl_over_ssl` support
30
+ - Unlock Ruby Kafka + provide support for 0.7 only
31
+ - #60 - Rename listener to StdoutListener
32
+ - Drop support for Kafka 0.10 in favor of native support for Kafka 0.11.
33
+ - Support ruby-kafka 0.7
34
+ - Support message headers
35
+ - `sasl_over_ssl` support
36
+ - `ssl_client_cert_key_password` support
37
+ - #87 - Make stdout listener as instance
38
+ - Use Zeitwerk for gem code loading
39
+ - #93 - zstd compression support
40
+ - #99 - schemas are renamed to contracts
41
+ - Bump delivery_boy (0.2.7 => 0.2.8)
42
+
43
+ ## 1.2.5
44
+ - Bump dependencies to match Karafka
45
+ - drop jruby support
46
+ - drop ruby 2.2 support
47
+
48
+ ## 1.2.4
49
+ - Due to multiple requests, unlock of 0.7 with an additional post-install message
50
+
51
+ ## 1.2.3
52
+ - Lock ruby-kafka to 0.6 (0.7 support targeted for WaterDrop 1.3)
53
+
54
+ ## 1.2.2
55
+ - #55 - Codec settings unification and config applier
56
+
57
+ ## 1.2.1
58
+ - #54 - compression_codec api sync with king-konf requirements
59
+
60
+ ## 1.2.0
61
+ - #45 - Allow specifying a create time for messages
62
+ - #47 - Support SCRAM once released
63
+ - #49 - Add lz4 support once merged and released
64
+ - #50 - Potential message loss in async mode
65
+ - Ruby 2.5.0 support
66
+ - Gem bump to match Karafka framework versioning
67
+ - #48 - ssl_ca_certs_from_system
68
+ - #52 - Use instrumentation compatible with Karafka 1.2
69
+
70
+ ## 1.0.1
71
+ - Added high level retry on connection problems
72
+
73
+ ## 1.0.0
74
+
75
+ - #37 - ack level for producer
76
+ - Gem bump
77
+ - Ruby 2.4.2 support
78
+ - Raw ruby-kafka driver is now replaced with delivery_boy
79
+ - Sync and async producers
80
+ - Complete update of the API
81
+ - Much better validations for config details
82
+ - Complete API remodel - please read the new README
83
+ - Renamed send_messages to deliver
84
+
85
+ ## 0.4
86
+ - Bump to match Karafka
87
+ - Renamed ```hosts``` to ```seed_brokers```
88
+ - Removed the ```ssl``` scoping for ```kafka``` config namespace to better match Karafka conventions
89
+ - Added ```client_id``` option on a root config level
90
+ - Added ```logger``` option on a root config level
91
+ - Auto Propagation of config down to ruby-kafka
92
+
93
+ ## 0.3.2
94
+ - Removed support for Ruby 2.1.*
95
+ - ~~Ruby 2.3.3 as default~~
96
+ - Ruby 2.4.0 as default
97
+ - Gem dump x2
98
+ - Dry configurable config (#20)
99
+ - added .rspec for default spec helper require
100
+ - Added SSL capabilities
101
+ - Coditsu instead of PG dev tools for quality control
102
+
103
+ ## 0.3.1
104
+ - Dev tools update
105
+ - Gem update
106
+ - Specs updates
107
+ - File naming convention fix from waterdrop to water_drop + compatibility file
108
+ - Additional params (partition, etc) that can be passed into producer
109
+
110
+ ## 0.3.0
111
+ - Driver change from Poseidon (not maintained) to Ruby-Kafka
112
+
113
+ ## 0.2.0
114
+ - Version dump - this WaterDrop version no longer relies on Aspector to work
115
+ - #17 - Logger for Aspector - WaterDrop no longer depends on Aspector
116
+ - #8 - add send date as a default value added to a message - wont-fix. Should be implemented on a message level since WaterDrop just transports messages without adding additional stuff.
117
+ - #11 - same as above
118
+
119
+ ## 0.1.13
120
+ - Resolved bug #15. When you use waterdrop in aspect way, message will be automatically parse to JSON.
121
+
122
+ ## 0.1.12
123
+ - Removed default to_json casting because of binary/other data types incompatibility. This is an incompatibility. If you use WaterDrop, please add a proper casting method to places where you use it.
124
+ - Gem dump
125
+
126
+ ## 0.1.11
127
+ - Poseidon options extractions and tweaks
128
+
129
+ ## 0.1.10
130
+ - Switched raise_on_failure to ignore all StandardError failures (or not to), not just specific once
131
+ - Reloading inside connection pool connection that seems to be broken (one that failed) - this should prevent from multiple issues (but not from single one) that are related to the connection
132
+
133
+ ## 0.1.9
134
+ - Required acks and set to -1 (most secure but slower)
135
+ - Added a proxy layer to to producer so we could replace Kafka with other messaging systems
136
+ - Gem dump
137
+
138
+ ## 0.1.8
139
+ - proper poseidon clients names (not duplicated)
140
+
141
+ ## 0.1.7
142
+ - kafka_host, kafka_hosts and kafka_ports settings consistency fix
143
+
144
+ ## 0.1.6
145
+ - Added null-logger gem
146
+
147
+ ## 0.1.5
148
+ - raise_on_failure flag to ignore (if false) that message was not sent
149
+
150
+ ## 0.1.4
151
+ - Renamed WaterDrop::Event to WaterDrop::Message to follow Apache Kafka naming convention
152
+
153
+ ## 0.1.3
154
+ - Gems cleanup
155
+ - Requirements fix
156
+
157
+ ## 0.1.2
158
+ - Initial gem release
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gemspec
6
+
7
+ group :test do
8
+ gem 'rspec'
9
+ gem 'simplecov'
10
+ end
@@ -0,0 +1,102 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ waterdrop (1.4.0)
5
+ delivery_boy (>= 0.2, < 2.x)
6
+ dry-configurable (~> 0.8)
7
+ dry-monitor (~> 0.3)
8
+ dry-validation (~> 1.2)
9
+ ruby-kafka (>= 0.7.8)
10
+ zeitwerk (~> 2.1)
11
+
12
+ GEM
13
+ remote: https://rubygems.org/
14
+ specs:
15
+ concurrent-ruby (1.1.7)
16
+ delivery_boy (1.0.1)
17
+ king_konf (~> 0.3)
18
+ ruby-kafka (~> 1.0)
19
+ diff-lcs (1.4.4)
20
+ digest-crc (0.6.1)
21
+ rake (~> 13.0)
22
+ docile (1.3.2)
23
+ dry-configurable (0.11.6)
24
+ concurrent-ruby (~> 1.0)
25
+ dry-core (~> 0.4, >= 0.4.7)
26
+ dry-equalizer (~> 0.2)
27
+ dry-container (0.7.2)
28
+ concurrent-ruby (~> 1.0)
29
+ dry-configurable (~> 0.1, >= 0.1.3)
30
+ dry-core (0.4.9)
31
+ concurrent-ruby (~> 1.0)
32
+ dry-equalizer (0.3.0)
33
+ dry-events (0.2.0)
34
+ concurrent-ruby (~> 1.0)
35
+ dry-core (~> 0.4)
36
+ dry-equalizer (~> 0.2)
37
+ dry-inflector (0.2.0)
38
+ dry-initializer (3.0.3)
39
+ dry-logic (1.0.7)
40
+ concurrent-ruby (~> 1.0)
41
+ dry-core (~> 0.2)
42
+ dry-equalizer (~> 0.2)
43
+ dry-monitor (0.3.2)
44
+ dry-configurable (~> 0.5)
45
+ dry-core (~> 0.4)
46
+ dry-equalizer (~> 0.2)
47
+ dry-events (~> 0.2)
48
+ dry-schema (1.5.3)
49
+ concurrent-ruby (~> 1.0)
50
+ dry-configurable (~> 0.8, >= 0.8.3)
51
+ dry-core (~> 0.4)
52
+ dry-equalizer (~> 0.2)
53
+ dry-initializer (~> 3.0)
54
+ dry-logic (~> 1.0)
55
+ dry-types (~> 1.4)
56
+ dry-types (1.4.0)
57
+ concurrent-ruby (~> 1.0)
58
+ dry-container (~> 0.3)
59
+ dry-core (~> 0.4, >= 0.4.4)
60
+ dry-equalizer (~> 0.3)
61
+ dry-inflector (~> 0.1, >= 0.1.2)
62
+ dry-logic (~> 1.0, >= 1.0.2)
63
+ dry-validation (1.5.4)
64
+ concurrent-ruby (~> 1.0)
65
+ dry-container (~> 0.7, >= 0.7.1)
66
+ dry-core (~> 0.4)
67
+ dry-equalizer (~> 0.2)
68
+ dry-initializer (~> 3.0)
69
+ dry-schema (~> 1.5)
70
+ king_konf (0.3.7)
71
+ rake (13.0.1)
72
+ rspec (3.9.0)
73
+ rspec-core (~> 3.9.0)
74
+ rspec-expectations (~> 3.9.0)
75
+ rspec-mocks (~> 3.9.0)
76
+ rspec-core (3.9.2)
77
+ rspec-support (~> 3.9.3)
78
+ rspec-expectations (3.9.2)
79
+ diff-lcs (>= 1.2.0, < 2.0)
80
+ rspec-support (~> 3.9.0)
81
+ rspec-mocks (3.9.1)
82
+ diff-lcs (>= 1.2.0, < 2.0)
83
+ rspec-support (~> 3.9.0)
84
+ rspec-support (3.9.3)
85
+ ruby-kafka (1.2.0)
86
+ digest-crc
87
+ simplecov (0.19.0)
88
+ docile (~> 1.1)
89
+ simplecov-html (~> 0.11)
90
+ simplecov-html (0.12.2)
91
+ zeitwerk (2.4.0)
92
+
93
+ PLATFORMS
94
+ ruby
95
+
96
+ DEPENDENCIES
97
+ rspec
98
+ simplecov
99
+ waterdrop!
100
+
101
+ BUNDLED WITH
102
+ 2.1.4
@@ -0,0 +1,18 @@
1
+ Permission is hereby granted, free of charge, to any person obtaining
2
+ a copy of this software and associated documentation files (the
3
+ "Software"), to deal in the Software without restriction, including
4
+ without limitation the rights to use, copy, modify, merge, publish,
5
+ distribute, sublicense, and/or sell copies of the Software, and to
6
+ permit persons to whom the Software is furnished to do so, subject to
7
+ the following conditions:
8
+
9
+ The above copyright notice and this permission notice shall be
10
+ included in all copies or substantial portions of the Software.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
13
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
14
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
15
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
16
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
17
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
18
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,127 @@
1
+ # WaterDrop
2
+
3
+ [![Build Status](https://travis-ci.org/karafka/waterdrop.svg)](https://travis-ci.org/karafka/waterdrop)
4
+ [![Join the chat at https://gitter.im/karafka/karafka](https://badges.gitter.im/karafka/karafka.svg)](https://gitter.im/karafka/karafka?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
5
+
6
+ Gem used to send messages to Kafka in an easy way with an extra validation layer. It is a part of the [Karafka](https://github.com/karafka/karafka) ecosystem.
7
+
8
+ WaterDrop is based on Zendesks [delivery_boy](https://github.com/zendesk/delivery_boy) gem.
9
+
10
+ It is:
11
+
12
+ - Thread safe
13
+ - Supports sync and async producers
14
+ - Working with 0.11+ Kafka
15
+
16
+ ## Installation
17
+
18
+ ```ruby
19
+ gem install waterdrop
20
+ ```
21
+
22
+ or add this to your Gemfile:
23
+
24
+ ```ruby
25
+ gem 'waterdrop'
26
+ ```
27
+
28
+ and run
29
+
30
+ ```
31
+ bundle install
32
+ ```
33
+
34
+ ## Setup
35
+
36
+ WaterDrop is a complex tool, that contains multiple configuration options. To keep everything organized, all the configuration options were divided into two groups:
37
+
38
+ - WaterDrop options - options directly related to Karafka framework and it's components
39
+ - Ruby-Kafka driver options - options related to Ruby-Kafka/Delivery boy
40
+
41
+ To apply all those configuration options, you need to use the ```#setup``` method:
42
+
43
+ ```ruby
44
+ WaterDrop.setup do |config|
45
+ config.deliver = true
46
+ config.kafka.seed_brokers = %w[kafka://localhost:9092]
47
+ end
48
+ ```
49
+
50
+ ### WaterDrop configuration options
51
+
52
+ | Option | Description |
53
+ |-----------------------------|------------------------------------------------------------------|
54
+ | client_id | This is how the client will identify itself to the Kafka brokers |
55
+ | logger | Logger that we want to use |
56
+ | deliver | Should we send messages to Kafka |
57
+
58
+ ### Ruby-Kafka driver and Delivery boy configuration options
59
+
60
+ **Note:** We've listed here only **the most important** configuration options. If you're interested in all the options, please go to the [config.rb](https://github.com/karafka/waterdrop/blob/master/lib/water_drop/config.rb) file for more details.
61
+
62
+ **Note:** All the options are subject to validations. In order to check what is and what is not acceptable, please go to the [config.rb validation schema](https://github.com/karafka/waterdrop/blob/master/lib/water_drop/schemas/config.rb) file.
63
+
64
+ | Option | Description |
65
+ |--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------|
66
+ | raise_on_buffer_overflow | Should we raise an exception, when messages can't be sent in an async way due to the message buffer overflow or should we just drop them |
67
+ | delivery_interval | The number of seconds between background message deliveries. Disable timer-based background deliveries by setting this to 0. |
68
+ | delivery_threshold | The number of buffered messages that will trigger a background message delivery. Disable buffer size based background deliveries by setting this to 0.|
69
+ | required_acks | The number of Kafka replicas that must acknowledge messages before they're considered as successfully written. |
70
+ | ack_timeout | A timeout executed by a broker when the client is sending messages to it. |
71
+ | max_retries | The number of retries when attempting to deliver messages. |
72
+ | retry_backoff | The number of seconds to wait after a failed attempt to send messages to a Kafka broker before retrying. |
73
+ | max_buffer_bytesize | The maximum number of bytes allowed in the buffer before new messages are rejected. |
74
+ | max_buffer_size | The maximum number of messages allowed in the buffer before new messages are rejected. |
75
+ | max_queue_size | The maximum number of messages allowed in the queue before new messages are rejected. |
76
+ | sasl_plain_username | The username used to authenticate. |
77
+ | sasl_plain_password | The password used to authenticate. |
78
+
79
+ This configuration can be also placed in *config/initializers* and can vary based on the environment:
80
+
81
+ ```ruby
82
+ WaterDrop.setup do |config|
83
+ config.deliver = Rails.env.production?
84
+ config.kafka.seed_brokers = [Rails.env.production? ? 'kafka://prod-host:9091' : 'kafka://localhost:9092']
85
+ end
86
+ ```
87
+
88
+ ## Usage
89
+
90
+ To send Kafka messages, just use one of the producers:
91
+
92
+ ```ruby
93
+ WaterDrop::SyncProducer.call('message', topic: 'my-topic')
94
+ # or for async
95
+ WaterDrop::AsyncProducer.call('message', topic: 'my-topic')
96
+ ```
97
+
98
+ Both ```SyncProducer``` and ```AsyncProducer``` accept following options:
99
+
100
+ | Option | Required | Value type | Description |
101
+ |-------------------- |----------|------------|---------------------------------------------------------------------|
102
+ | ```topic``` | true | String | The Kafka topic that should be written to |
103
+ | ```key``` | false | String | The key that should be set in the Kafka message |
104
+ | ```partition``` | false | Integer | A specific partition number that should be written to |
105
+ | ```partition_key``` | false | String | A string that can be used to deterministically select the partition |
106
+ | ```create_time``` | false | Time | The timestamp that should be set on the message |
107
+ | ```headers``` | false | Hash | Headers for the message |
108
+
109
+ Keep in mind, that message you want to send should be either binary or stringified (to_s, to_json, etc).
110
+
111
+ ## References
112
+
113
+ * [Karafka framework](https://github.com/karafka/karafka)
114
+ * [WaterDrop Travis CI](https://travis-ci.org/karafka/waterdrop)
115
+ * [WaterDrop Coditsu](https://app.coditsu.io/karafka/repositories/waterdrop)
116
+
117
+ ## Note on contributions
118
+
119
+ First, thank you for considering contributing to WaterDrop! It's people like you that make the open source community such a great community!
120
+
121
+ Each pull request must pass all the RSpec specs and meet our quality requirements.
122
+
123
+ To check if everything is as it should be, we use [Coditsu](https://coditsu.io) that combines multiple linters and code analyzers for both code and documentation. Once you're done with your changes, submit a pull request.
124
+
125
+ Coditsu will automatically check your work against our quality standards. You can find your commit check results on the [builds page](https://app.coditsu.io/karafka/repositories/waterdrop/builds/commit_builds) of WaterDrop repository.
126
+
127
+ [![coditsu](https://coditsu.io/assets/quality_bar.svg)](https://app.coditsu.io/karafka/repositories/waterdrop/builds/commit_builds)