pheromone 0.3.3 → 0.4.0
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 +4 -4
- data/README.md +14 -35
- data/lib/generators/pheromone/initializer_generator.rb +1 -4
- data/lib/pheromone/messaging/message.rb +3 -6
- data/lib/pheromone/version.rb +1 -1
- data/lib/pheromone.rb +1 -0
- data/pheromone.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1f7b989beed62ff229ddb99eadf5e30a40e96442
|
|
4
|
+
data.tar.gz: 5d3edfdf9e503ac121bac5ee34ca7953f3c2549e
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c2f234b68fbf3cd0c7e0e314d8f902e189cb04882661b26c4e5d29aea8a9e3565fd24f596934900f8c2a1699160981d88bdd636d55bd90c0e45d74ece0e41fb0
|
|
7
|
+
data.tar.gz: 588b6d95467b997f447a217d266cd29d6501275c90a8d5e125bee326fcdf9ab04ae37a2074e72c37d72c3634e56c07aed9692539399647ea3c64e72c600c58b3
|
data/README.md
CHANGED
|
@@ -28,22 +28,19 @@ In order to setup `pheromone`, both `waterdrop` and `pheromone` need to be setup
|
|
|
28
28
|
|
|
29
29
|
$ bundle exec rails generate pheromone:initializer
|
|
30
30
|
|
|
31
|
-
This will generate the following
|
|
31
|
+
This will generate the following in `config/initializers/pheromone.rb`
|
|
32
32
|
|
|
33
33
|
```
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
" waterdrop_config.raise_on_failure = Rails.env.production?\n"\
|
|
45
|
-
" end\n"\
|
|
46
|
-
"end"\
|
|
34
|
+
Pheromone.setup do |pheromone_config|
|
|
35
|
+
# pheromone_config.background_processor.name = ':resque / :sidekiq'
|
|
36
|
+
# pheromone_config.background_processor.klass = 'BackgroundWorker'
|
|
37
|
+
# pheromone_config.timezone = 'UTC'
|
|
38
|
+
pheromone_config.message_format = :json
|
|
39
|
+
WaterDrop.setup do |waterdrop_config|
|
|
40
|
+
waterdrop_config.deliver = Rails.env.production?
|
|
41
|
+
waterdrop_config.kafka.seed_brokers = [Rails.env.production? ? ENV['KAFKA_HOST'] : 'localhost:9092']
|
|
42
|
+
end
|
|
43
|
+
end
|
|
47
44
|
```
|
|
48
45
|
|
|
49
46
|
Edit this file to modify the default config. The following configuration options are available:
|
|
@@ -55,11 +52,6 @@ Edit this file to modify the default config. The following configuration options
|
|
|
55
52
|
| background_processor.klass | String | Background processor class name that sends messages to kafka |
|
|
56
53
|
| timezone_format | String | Valid timezone name for timestamps sent to kafka |
|
|
57
54
|
| message_format | Symbol | Only supports :json format currently |
|
|
58
|
-
| send_messages | Boolean | Should we send messages to Kafka |
|
|
59
|
-
| kafka.hosts | Array<String> | Kafka servers hosts with ports |
|
|
60
|
-
| connection_pool_size | Integer | Kafka connection pool size |
|
|
61
|
-
| connection_pool_timeout | Integer | Kafka connection pool timeout |
|
|
62
|
-
| raise_on_failure | Boolean | Should we raise an exception when we cannot send message to Kafka - if false will silently ignore failures (will just ignore them) |
|
|
63
55
|
|
|
64
56
|
The timezone setting will transform any timestamp attributes in the message to the specified format.
|
|
65
57
|
|
|
@@ -287,22 +279,9 @@ class PublishableModel < ActiveRecord::Base
|
|
|
287
279
|
topic: :topic_test,
|
|
288
280
|
message: ->(obj) { { name: obj.name } },
|
|
289
281
|
producer_options: {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
# The number of seconds to wait between retries. In order to handle longer
|
|
294
|
-
# periods of Kafka being unavailable, increase this number. The default is
|
|
295
|
-
# 1 second.
|
|
296
|
-
retry_backoff: 5,
|
|
297
|
-
# number of acknowledgements that the client should write to before returning
|
|
298
|
-
# possible values are :all, 0 or 1 and default behaviour is :all, requiring all
|
|
299
|
-
# replicas to acknowledge
|
|
300
|
-
required_acks: 1,
|
|
301
|
-
# compression can be enabled in order to improve bandwidth, and a minimum number
|
|
302
|
-
# of messages that need to be in the buffer before they are compressed can be
|
|
303
|
-
# specified using compression threshold
|
|
304
|
-
compression_codec: :snappy,
|
|
305
|
-
compression_threshold: 10
|
|
282
|
+
key: 'key',
|
|
283
|
+
partition: 1,
|
|
284
|
+
partition_key: 'key'
|
|
306
285
|
}
|
|
307
286
|
}
|
|
308
287
|
]
|
|
@@ -11,11 +11,8 @@ module Pheromone
|
|
|
11
11
|
" # pheromone_config.timezone = 'UTC'\n"\
|
|
12
12
|
" pheromone_config.message_format = :json\n"\
|
|
13
13
|
" WaterDrop.setup do |waterdrop_config|\n"\
|
|
14
|
-
" waterdrop_config.
|
|
15
|
-
" waterdrop_config.connection_pool.size = 20\n"\
|
|
16
|
-
" waterdrop_config.connection_pool.timeout = 1\n"\
|
|
14
|
+
" waterdrop_config.deliver = Rails.env.production?\n"\
|
|
17
15
|
" waterdrop_config.kafka.seed_brokers = [Rails.env.production? ? ENV['KAFKA_HOST'] : 'localhost:9092']\n"\
|
|
18
|
-
" waterdrop_config.raise_on_failure = Rails.env.production?\n"\
|
|
19
16
|
" end\n"\
|
|
20
17
|
"end"\
|
|
21
18
|
)
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
require 'waterdrop'
|
|
2
|
-
|
|
3
1
|
# Encapsulates WaterDrop::Message
|
|
4
2
|
module Pheromone
|
|
5
3
|
module Messaging
|
|
@@ -14,11 +12,10 @@ module Pheromone
|
|
|
14
12
|
attr_reader :topic, :blob, :options, :metadata
|
|
15
13
|
|
|
16
14
|
def send!
|
|
17
|
-
|
|
18
|
-
topic,
|
|
15
|
+
WaterDrop::SyncProducer.call(
|
|
19
16
|
MessageFormatter.new(full_message).format,
|
|
20
|
-
options
|
|
21
|
-
)
|
|
17
|
+
{ topic: topic.to_s }.merge!(options)
|
|
18
|
+
)
|
|
22
19
|
end
|
|
23
20
|
|
|
24
21
|
private
|
data/lib/pheromone/version.rb
CHANGED
data/lib/pheromone.rb
CHANGED
data/pheromone.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
|
24
24
|
spec.add_dependency 'activerecord', '>= 4.2.5'
|
|
25
25
|
spec.add_dependency 'bundler', '>= 0'
|
|
26
26
|
spec.add_dependency 'dry-configurable', '>= 0.5'
|
|
27
|
-
spec.add_dependency 'waterdrop', '>= 0
|
|
27
|
+
spec.add_dependency 'waterdrop', '>= 1.0'
|
|
28
28
|
|
|
29
29
|
spec.add_development_dependency 'activesupport', '>= 4.2.5'
|
|
30
30
|
spec.add_development_dependency 'generator_spec', '~> 0.9.3'
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pheromone
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Ankita Gupta
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2017-
|
|
11
|
+
date: 2017-11-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: active_model_serializers
|
|
@@ -72,14 +72,14 @@ dependencies:
|
|
|
72
72
|
requirements:
|
|
73
73
|
- - ">="
|
|
74
74
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '0
|
|
75
|
+
version: '1.0'
|
|
76
76
|
type: :runtime
|
|
77
77
|
prerelease: false
|
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
79
|
requirements:
|
|
80
80
|
- - ">="
|
|
81
81
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '0
|
|
82
|
+
version: '1.0'
|
|
83
83
|
- !ruby/object:Gem::Dependency
|
|
84
84
|
name: activesupport
|
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|