harmoniser 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -0
- data/harmoniser.gemspec +0 -3
- data/lib/harmoniser/connection.rb +1 -1
- data/lib/harmoniser/launcher.rb +4 -4
- data/lib/harmoniser/publisher.rb +3 -2
- data/lib/harmoniser/subscriber.rb +3 -1
- data/lib/harmoniser/topology.rb +3 -0
- data/lib/harmoniser/version.rb +1 -1
- data/lib/harmoniser.rb +6 -0
- metadata +2 -44
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cd51302d5c886af771b66e4528054042a8922071669719ba625aac5d5c0dc503
|
4
|
+
data.tar.gz: 2dd00c5d6699436fca25d6c721cba80518aa8baa967e3bca247af408b829582b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6f2f43e8bc13d89db74bc38da9e08b86773aea3582cf5df277c985df22a016aa22bc5f965243b3df451c9f22ff40bc16299aeece5b7d5d15d57b6a43fb8b2233
|
7
|
+
data.tar.gz: e3768b89e31de5b74b27333a990247b416067acc6055e4a1ea15d3ad63560a91780d9f379ced069f0cc9c950907186d2e67cd5daaacfaaf4b4f64b8715804415
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## [0.9.0] - 2024-08-09
|
4
|
+
|
5
|
+
### Added
|
6
|
+
- Add debug log when a message is received by a subscriber
|
7
|
+
- Add error_class, error_message and error_backtrace for `--require` option from cli
|
8
|
+
|
9
|
+
### Changed
|
10
|
+
- Amend debug log when a message is published so that exchange name is included
|
11
|
+
- Improve error message for MissingExchangeDefinition and
|
12
|
+
MissingConsumerDefinition
|
13
|
+
- Define dev dependencies through Gemfile instead of gemspec
|
14
|
+
- Changed Topology methods to return self so that Topology definition becomes chainable
|
15
|
+
|
16
|
+
## [0.8.1] - 2024-04-08
|
17
|
+
|
18
|
+
### Fixed
|
19
|
+
- Exit ruby process when harmoniser is not the main process. More details at [issue](https://github.com/jollopre/harmoniser/issues/41).
|
20
|
+
|
3
21
|
## [0.8.0] - 2024-03-31
|
4
22
|
|
5
23
|
### Added
|
data/harmoniser.gemspec
CHANGED
@@ -25,7 +25,4 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.require_paths = ["lib"]
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "bunny", "~> 2.22"
|
28
|
-
spec.add_development_dependency "rake", "~> 13.0"
|
29
|
-
spec.add_development_dependency "rspec", "~> 3"
|
30
|
-
spec.add_development_dependency "standardrb", "~> 1.0"
|
31
28
|
end
|
data/lib/harmoniser/launcher.rb
CHANGED
@@ -34,14 +34,14 @@ module Harmoniser
|
|
34
34
|
def load_rails
|
35
35
|
filepath = File.expand_path("#{@configuration.require}/config/environment.rb")
|
36
36
|
require filepath
|
37
|
-
rescue LoadError
|
38
|
-
@logger.warn("Error while requiring file within directory. No subscribers will run for this process: require = `#{@configuration.require}`, filepath = `#{filepath}`")
|
37
|
+
rescue LoadError => e
|
38
|
+
@logger.warn("Error while requiring file within directory. No subscribers will run for this process: require = `#{@configuration.require}`, filepath = `#{filepath}`, error_class = `#{e.class}`, error_message = `#{e.message}`, error_backtrace = `#{e.backtrace&.first(5)}`")
|
39
39
|
end
|
40
40
|
|
41
41
|
def load_file
|
42
42
|
require @configuration.require
|
43
|
-
rescue LoadError
|
44
|
-
@logger.warn("Error while requiring file. No subscribers will run for this process: require = `#{@configuration.require}`")
|
43
|
+
rescue LoadError => e
|
44
|
+
@logger.warn("Error while requiring file. No subscribers will run for this process: require = `#{@configuration.require}`, error_class = `#{e.class}`, error_message = `#{e.message}`, error_backtrace = `#{e.backtrace&.first(5)}`")
|
45
45
|
end
|
46
46
|
end
|
47
47
|
end
|
data/lib/harmoniser/publisher.rb
CHANGED
@@ -21,7 +21,7 @@ module Harmoniser
|
|
21
21
|
const_get(:HARMONISER_PUBLISHER_MUTEX).synchronize do
|
22
22
|
harmoniser_exchange.publish(payload, opts)
|
23
23
|
end
|
24
|
-
Harmoniser.logger.debug { "Message published: payload = `#{payload}`, opts = `#{opts}`" }
|
24
|
+
Harmoniser.logger.debug { "Message published: exchange = `#{@harmoniser_exchange_definition.name}`, payload = `#{payload}`, opts = `#{opts}`" }
|
25
25
|
|
26
26
|
harmoniser_exchange
|
27
27
|
end
|
@@ -44,7 +44,7 @@ module Harmoniser
|
|
44
44
|
end
|
45
45
|
|
46
46
|
def raise_missing_exchange_definition
|
47
|
-
raise MissingExchangeDefinition, "Please
|
47
|
+
raise MissingExchangeDefinition, "Please call the harmoniser_publisher class method at `#{const_get(:HARMONISER_PUBLISHER_CLASS)}` with the exchange_name that will be used for publishing"
|
48
48
|
end
|
49
49
|
|
50
50
|
def handle_return(exchange)
|
@@ -57,6 +57,7 @@ module Harmoniser
|
|
57
57
|
class << self
|
58
58
|
def included(base)
|
59
59
|
base.const_set(:HARMONISER_PUBLISHER_MUTEX, Mutex.new)
|
60
|
+
base.const_set(:HARMONISER_PUBLISHER_CLASS, base)
|
60
61
|
base.extend(ClassMethods)
|
61
62
|
end
|
62
63
|
end
|
@@ -57,6 +57,7 @@ module Harmoniser
|
|
57
57
|
|
58
58
|
def handle_delivery(consumer)
|
59
59
|
consumer.on_delivery do |delivery_info, properties, payload|
|
60
|
+
Harmoniser.logger.debug { "Message received by a consumer: consumer_tag = `#{consumer.consumer_tag}, `payload = `#{payload}`, queue = `#{consumer.queue}`" }
|
60
61
|
if respond_to?(:on_delivery)
|
61
62
|
on_delivery(delivery_info, properties, payload)
|
62
63
|
else
|
@@ -70,13 +71,14 @@ module Harmoniser
|
|
70
71
|
end
|
71
72
|
|
72
73
|
def raise_missing_consumer_definition
|
73
|
-
raise MissingConsumerDefinition, "Please
|
74
|
+
raise MissingConsumerDefinition, "Please call the harmoniser_subscriber class method at `#{const_get(:HARMONISER_SUBSCRIBER_CLASS)}` with the queue_name that will be used for subscribing"
|
74
75
|
end
|
75
76
|
end
|
76
77
|
|
77
78
|
class << self
|
78
79
|
def included(base)
|
79
80
|
base.const_set(:HARMONISER_SUBSCRIBER_MUTEX, Mutex.new)
|
81
|
+
base.const_set(:HARMONISER_SUBSCRIBER_CLASS, base)
|
80
82
|
base.extend(ClassMethods)
|
81
83
|
harmoniser_register_included(base)
|
82
84
|
end
|
data/lib/harmoniser/topology.rb
CHANGED
@@ -19,6 +19,7 @@ module Harmoniser
|
|
19
19
|
name: name,
|
20
20
|
opts: opts
|
21
21
|
)
|
22
|
+
self
|
22
23
|
end
|
23
24
|
|
24
25
|
def add_queue(name, **opts)
|
@@ -26,6 +27,7 @@ module Harmoniser
|
|
26
27
|
name: name,
|
27
28
|
opts: opts
|
28
29
|
)
|
30
|
+
self
|
29
31
|
end
|
30
32
|
|
31
33
|
def add_binding(exchange_name, destination_name, destination_type = :queue, **opts)
|
@@ -35,6 +37,7 @@ module Harmoniser
|
|
35
37
|
destination_type: destination_type,
|
36
38
|
opts: opts
|
37
39
|
)
|
40
|
+
self
|
38
41
|
end
|
39
42
|
|
40
43
|
def declare
|
data/lib/harmoniser/version.rb
CHANGED
data/lib/harmoniser.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: harmoniser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jose Lloret
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-08-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -24,48 +24,6 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.22'
|
27
|
-
- !ruby/object:Gem::Dependency
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - "~>"
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '13.0'
|
34
|
-
type: :development
|
35
|
-
prerelease: false
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
37
|
-
requirements:
|
38
|
-
- - "~>"
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
version: '13.0'
|
41
|
-
- !ruby/object:Gem::Dependency
|
42
|
-
name: rspec
|
43
|
-
requirement: !ruby/object:Gem::Requirement
|
44
|
-
requirements:
|
45
|
-
- - "~>"
|
46
|
-
- !ruby/object:Gem::Version
|
47
|
-
version: '3'
|
48
|
-
type: :development
|
49
|
-
prerelease: false
|
50
|
-
version_requirements: !ruby/object:Gem::Requirement
|
51
|
-
requirements:
|
52
|
-
- - "~>"
|
53
|
-
- !ruby/object:Gem::Version
|
54
|
-
version: '3'
|
55
|
-
- !ruby/object:Gem::Dependency
|
56
|
-
name: standardrb
|
57
|
-
requirement: !ruby/object:Gem::Requirement
|
58
|
-
requirements:
|
59
|
-
- - "~>"
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
version: '1.0'
|
62
|
-
type: :development
|
63
|
-
prerelease: false
|
64
|
-
version_requirements: !ruby/object:Gem::Requirement
|
65
|
-
requirements:
|
66
|
-
- - "~>"
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
version: '1.0'
|
69
27
|
description: A declarative approach to communication with RabbitMQ that simplifies
|
70
28
|
the integration of publishing and consuming messages.
|
71
29
|
email:
|