ears 0.5.0 → 0.6.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 +6 -1
- data/Gemfile.lock +1 -1
- data/README.md +4 -1
- data/lib/ears/configuration.rb +10 -0
- data/lib/ears/version.rb +1 -1
- data/lib/ears.rb +8 -1
- data/package-lock.json +23 -23
- data/package.json +3 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1bc62c3b6367b99bdd80d44f670f79bd38709587df8e0bbcb72201772b99a74
|
4
|
+
data.tar.gz: b2fd12a20e5b0879fc1a69efe3729e6a422f8cc20f57007098a4da21d0198b4c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21299077971e38f928ef72d047726ad99218fc6d4b3c0d73cdd9a179f0cf87d8d5fab6f129a7d4c5dd20d97190d3d1d73daf81f229f3bd79cb21d60a73c9af95
|
7
|
+
data.tar.gz: 8e92b3f7bba6f494fd563f210dd43f03a95e4df0bf1f722dd1a6a3052fee9c82038679d8e7568a0de5e1e6581cdb343caa6092cc151f63890c2105a0da3b8134
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## 0.
|
3
|
+
## 0.6.0 (2021-11-18)
|
4
|
+
|
5
|
+
- add `connection_name` to configuration and make it a mandatory setting
|
6
|
+
- validate configuration after calling `configure`
|
7
|
+
|
8
|
+
## 0.5.0 (2021-11-03)
|
4
9
|
|
5
10
|
- fix the fact that the configuration was never used and bunny silently fell back to the `RABBITMQ_URL` env var
|
6
11
|
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -22,16 +22,19 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
### Basic usage
|
24
24
|
|
25
|
-
First, you should configure
|
25
|
+
First, you should configure `Ears`.
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
require 'ears'
|
29
29
|
|
30
30
|
Ears.configure do |config|
|
31
31
|
config.rabbitmq_url = 'amqp://user:password@myrmq:5672'
|
32
|
+
config.connection_name = 'My Consumer'
|
32
33
|
end
|
33
34
|
```
|
34
35
|
|
36
|
+
_Note_: `connection_name` is a mandatory setting!
|
37
|
+
|
35
38
|
Next, define your exchanges, queues, and consumers by calling `Ears.setup`.
|
36
39
|
|
37
40
|
```ruby
|
data/lib/ears/configuration.rb
CHANGED
@@ -1,13 +1,23 @@
|
|
1
1
|
module Ears
|
2
2
|
# The class representing the global {Ears} configuration.
|
3
3
|
class Configuration
|
4
|
+
class ConnectionNameMissing < StandardError
|
5
|
+
end
|
6
|
+
|
4
7
|
DEFAULT_RABBITMQ_URL = 'amqp://guest:guest@localhost:5672'
|
5
8
|
|
6
9
|
# @return [String] the connection string for RabbitMQ.
|
7
10
|
attr_accessor :rabbitmq_url
|
8
11
|
|
12
|
+
# @return [String] the name for the RabbitMQ connection.
|
13
|
+
attr_accessor :connection_name
|
14
|
+
|
9
15
|
def initialize
|
10
16
|
@rabbitmq_url = DEFAULT_RABBITMQ_URL
|
11
17
|
end
|
18
|
+
|
19
|
+
def validate!
|
20
|
+
raise ConnectionNameMissing unless connection_name
|
21
|
+
end
|
12
22
|
end
|
13
23
|
end
|
data/lib/ears/version.rb
CHANGED
data/lib/ears.rb
CHANGED
@@ -18,6 +18,7 @@ module Ears
|
|
18
18
|
# @yieldparam configuration [Ears::Configuration] The global configuration instance.
|
19
19
|
def configure
|
20
20
|
yield(configuration)
|
21
|
+
configuration.validate!
|
21
22
|
end
|
22
23
|
|
23
24
|
# The global RabbitMQ connection used by Ears.
|
@@ -25,7 +26,12 @@ module Ears
|
|
25
26
|
# @return [Bunny::Session]
|
26
27
|
def connection
|
27
28
|
@connection ||=
|
28
|
-
Bunny
|
29
|
+
Bunny
|
30
|
+
.new(
|
31
|
+
configuration.rabbitmq_url,
|
32
|
+
connection_name: configuration.connection_name,
|
33
|
+
)
|
34
|
+
.tap { |conn| conn.start }
|
29
35
|
end
|
30
36
|
|
31
37
|
# The channel for the current thread.
|
@@ -67,6 +73,7 @@ module Ears
|
|
67
73
|
# Used internally for testing.
|
68
74
|
def reset!
|
69
75
|
@connection = nil
|
76
|
+
@configuration = nil
|
70
77
|
Thread.current[:ears_channel] = nil
|
71
78
|
end
|
72
79
|
end
|
data/package-lock.json
CHANGED
@@ -6,33 +6,33 @@
|
|
6
6
|
"": {
|
7
7
|
"name": "ears",
|
8
8
|
"devDependencies": {
|
9
|
-
"@invisionag/prettier-config-ivx": "^3.0.
|
10
|
-
"@prettier/plugin-ruby": "^
|
11
|
-
"prettier": "^2.4.
|
9
|
+
"@invisionag/prettier-config-ivx": "^3.0.1",
|
10
|
+
"@prettier/plugin-ruby": "^2.0.0",
|
11
|
+
"prettier": "^2.4.1"
|
12
12
|
}
|
13
13
|
},
|
14
14
|
"node_modules/@invisionag/prettier-config-ivx": {
|
15
|
-
"version": "3.0.
|
16
|
-
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config-ivx/-/prettier-config-ivx-3.0.
|
17
|
-
"integrity": "sha512-
|
15
|
+
"version": "3.0.1",
|
16
|
+
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config-ivx/-/prettier-config-ivx-3.0.1.tgz",
|
17
|
+
"integrity": "sha512-l9oq6oWH/5f55StS8btmB4LfebfziO9tOY62ItJBwF4nKeMgI/iKBJ97r9Sqkxbq3qOKERuG1u4rAStX9m9GTg==",
|
18
18
|
"dev": true,
|
19
19
|
"peerDependencies": {
|
20
20
|
"prettier": ">=2.0.0"
|
21
21
|
}
|
22
22
|
},
|
23
23
|
"node_modules/@prettier/plugin-ruby": {
|
24
|
-
"version": "
|
25
|
-
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-
|
26
|
-
"integrity": "sha512-
|
24
|
+
"version": "2.0.0",
|
25
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-2.0.0.tgz",
|
26
|
+
"integrity": "sha512-pA0rjTi5J7cT86XPNhXp7CpdV2Tlyj5oqDIsnQRxMu2P7LY2KJI/pyOSM8pzTH8BgRyQfe1P1NPCcTwxUnUWtQ==",
|
27
27
|
"dev": true,
|
28
28
|
"dependencies": {
|
29
|
-
"prettier": ">=
|
29
|
+
"prettier": ">=2.3.0"
|
30
30
|
}
|
31
31
|
},
|
32
32
|
"node_modules/prettier": {
|
33
|
-
"version": "2.4.
|
34
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.
|
35
|
-
"integrity": "sha512-
|
33
|
+
"version": "2.4.1",
|
34
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
|
35
|
+
"integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
|
36
36
|
"dev": true,
|
37
37
|
"bin": {
|
38
38
|
"prettier": "bin-prettier.js"
|
@@ -44,25 +44,25 @@
|
|
44
44
|
},
|
45
45
|
"dependencies": {
|
46
46
|
"@invisionag/prettier-config-ivx": {
|
47
|
-
"version": "3.0.
|
48
|
-
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config-ivx/-/prettier-config-ivx-3.0.
|
49
|
-
"integrity": "sha512-
|
47
|
+
"version": "3.0.1",
|
48
|
+
"resolved": "https://registry.npmjs.org/@invisionag/prettier-config-ivx/-/prettier-config-ivx-3.0.1.tgz",
|
49
|
+
"integrity": "sha512-l9oq6oWH/5f55StS8btmB4LfebfziO9tOY62ItJBwF4nKeMgI/iKBJ97r9Sqkxbq3qOKERuG1u4rAStX9m9GTg==",
|
50
50
|
"dev": true,
|
51
51
|
"requires": {}
|
52
52
|
},
|
53
53
|
"@prettier/plugin-ruby": {
|
54
|
-
"version": "
|
55
|
-
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-
|
56
|
-
"integrity": "sha512-
|
54
|
+
"version": "2.0.0",
|
55
|
+
"resolved": "https://registry.npmjs.org/@prettier/plugin-ruby/-/plugin-ruby-2.0.0.tgz",
|
56
|
+
"integrity": "sha512-pA0rjTi5J7cT86XPNhXp7CpdV2Tlyj5oqDIsnQRxMu2P7LY2KJI/pyOSM8pzTH8BgRyQfe1P1NPCcTwxUnUWtQ==",
|
57
57
|
"dev": true,
|
58
58
|
"requires": {
|
59
|
-
"prettier": ">=
|
59
|
+
"prettier": ">=2.3.0"
|
60
60
|
}
|
61
61
|
},
|
62
62
|
"prettier": {
|
63
|
-
"version": "2.4.
|
64
|
-
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.
|
65
|
-
"integrity": "sha512-
|
63
|
+
"version": "2.4.1",
|
64
|
+
"resolved": "https://registry.npmjs.org/prettier/-/prettier-2.4.1.tgz",
|
65
|
+
"integrity": "sha512-9fbDAXSBcc6Bs1mZrDYb3XKzDLm4EXXL9sC1LqKP5rZkT6KRr/rf9amVUcODVXgguK/isJz0d0hP72WeaKWsvA==",
|
66
66
|
"dev": true
|
67
67
|
}
|
68
68
|
}
|
data/package.json
CHANGED
@@ -7,9 +7,9 @@
|
|
7
7
|
"format": "npm run prettify -- --write"
|
8
8
|
},
|
9
9
|
"devDependencies": {
|
10
|
-
"@invisionag/prettier-config-ivx": "^3.0.
|
11
|
-
"@prettier/plugin-ruby": "^
|
12
|
-
"prettier": "^2.4.
|
10
|
+
"@invisionag/prettier-config-ivx": "^3.0.1",
|
11
|
+
"@prettier/plugin-ruby": "^2.0.0",
|
12
|
+
"prettier": "^2.4.1"
|
13
13
|
},
|
14
14
|
"prettier": "@invisionag/prettier-config-ivx"
|
15
15
|
}
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ears
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.6.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mario Mainz
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-11-
|
11
|
+
date: 2021-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|