phobos 1.3.0 → 1.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/CHANGELOG.md +5 -1
- data/README.md +5 -1
- data/lib/phobos/version.rb +1 -1
- data/lib/phobos.rb +10 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23596037a84092e128accdaee1bd9a8d5e53fe03
|
4
|
+
data.tar.gz: 68f30103a2d37881c7eea863b43abc40a75165f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f2cf322b532dd1d17de02b7c3d77b2191edc8817831dc280ac6f011f5ae68a9d776b13907fa22491b1eeb1ec7479cb476d63b8ba2a35b4c3cadd8d26667e6b6
|
7
|
+
data.tar.gz: 19071993977bcff9487efdd580c80d1d3959b55841508d9e3be683a5bffd762541521bbdbcd85ce9991f48383ee8c045dd42d790c236df482774122c638d56d3
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
|
|
4
4
|
The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
5
5
|
and this project adheres to [Semantic Versioning](http://semver.org/).
|
6
6
|
|
7
|
+
## 1.4.0 (2017-08-21)
|
8
|
+
|
9
|
+
- [enhancement] Add support for hash provided settings #30
|
10
|
+
|
7
11
|
## 1.3.0 (2017-06-15)
|
8
12
|
|
9
13
|
- [enhancement] Add support for erb syntax in phobos config file #26
|
@@ -20,7 +24,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
20
24
|
|
21
25
|
## 1.1.0 (2016-09-02)
|
22
26
|
|
23
|
-
- [enhancement]
|
27
|
+
- [enhancement] Removed Hashie as a dependency #12
|
24
28
|
- [feature] Allow configuring consumers min_bytes & max_wait_time #15
|
25
29
|
- [feature] Allow configuring producers max_queue_size, delivery_threshold & delivery_interval #16
|
26
30
|
- [feature] Allow configuring force_encoding for message payload #18
|
data/README.md
CHANGED
@@ -248,11 +248,15 @@ MyProducer
|
|
248
248
|
|
249
249
|
When running as a standalone service, Phobos sets up a `Listener` and `Executor` for you. When you use Phobos as a library in your own project, you need to set these components up yourself.
|
250
250
|
|
251
|
-
First, call the method `configure` with the path of your configuration file
|
251
|
+
First, call the method `configure` with the path of your configuration file or with configuration settings hash.
|
252
252
|
|
253
253
|
```ruby
|
254
254
|
Phobos.configure('config/phobos.yml')
|
255
255
|
```
|
256
|
+
or
|
257
|
+
```ruby
|
258
|
+
Phobos.configure(kafka: { client_id: 'phobos' }, logger: { file: 'log/phobos.log' })
|
259
|
+
```
|
256
260
|
|
257
261
|
__Listener__ connects to Kafka and acts as your consumer. To create a listener you need a handler class, a topic, and a group id.
|
258
262
|
|
data/lib/phobos/version.rb
CHANGED
data/lib/phobos.rb
CHANGED
@@ -27,9 +27,9 @@ module Phobos
|
|
27
27
|
attr_reader :config, :logger
|
28
28
|
attr_accessor :silence_log
|
29
29
|
|
30
|
-
def configure(
|
30
|
+
def configure(configuration)
|
31
31
|
ENV['RAILS_ENV'] = ENV['RACK_ENV'] ||= 'development'
|
32
|
-
@config = DeepStruct.new(
|
32
|
+
@config = DeepStruct.new(fetch_settings(configuration))
|
33
33
|
@config.class.send(:define_method, :producer_hash) { Phobos.config.producer&.to_hash }
|
34
34
|
@config.class.send(:define_method, :consumer_hash) { Phobos.config.consumer&.to_hash }
|
35
35
|
configure_logger
|
@@ -73,5 +73,13 @@ module Phobos
|
|
73
73
|
@logger = Logging.logger[self]
|
74
74
|
@logger.appenders = appenders
|
75
75
|
end
|
76
|
+
|
77
|
+
private
|
78
|
+
|
79
|
+
def fetch_settings(configuration)
|
80
|
+
return configuration.to_h if configuration.respond_to?(:to_h)
|
81
|
+
|
82
|
+
YAML.load(ERB.new(File.read(File.expand_path(configuration))).result)
|
83
|
+
end
|
76
84
|
end
|
77
85
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: phobos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Túlio Ornelas
|
@@ -13,7 +13,7 @@ authors:
|
|
13
13
|
autorequire:
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
|
-
date: 2017-
|
16
|
+
date: 2017-08-21 00:00:00.000000000 Z
|
17
17
|
dependencies:
|
18
18
|
- !ruby/object:Gem::Dependency
|
19
19
|
name: bundler
|