harmoniser 0.2.0 → 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/CHANGELOG.md +20 -5
- data/README.md +4 -2
- data/harmoniser.gemspec +4 -4
- data/lib/harmoniser/channelable.rb +14 -2
- data/lib/harmoniser/configuration.rb +8 -8
- data/lib/harmoniser/launcher.rb +1 -1
- data/lib/harmoniser/publisher.rb +2 -2
- data/lib/harmoniser/subscriber.rb +1 -1
- data/lib/harmoniser/topology.rb +1 -1
- data/lib/harmoniser/version.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1feaead73df2956797f89d33ed45a3316cf5191852946c1b0d3cbe2e2284f18
|
4
|
+
data.tar.gz: 6ba7ae634d24a012d4243d392d4299a9fd88a35af5df1251efec24bb4817ce9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cfcdeec3f6e205c9301d5f2142cd8e7fee0723ed5950fdf1bd12a704f1cc29ecf971e39c75ef7ace071ea577a37f45a874c4016a63c561d25c3e206f1fb0e6f
|
7
|
+
data.tar.gz: 45b409fb2bfa3ec1752101915fad8f52ccf1e5a5ea1402e23ee6fc062e952fbdb78a16015f77bc2ef2ddafda04859eb23d0e9c8c9cef06a9675fe0c44e81f5d5
|
data/CHANGELOG.md
CHANGED
@@ -1,16 +1,31 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [0.
|
3
|
+
## [0.4.0] - 2023-12-07
|
4
4
|
|
5
5
|
### Added
|
6
|
+
- Default logger with error severity for when errors occur at channel level
|
7
|
+
- Default logger with error severity for when errors occur while processing a message from a queue
|
6
8
|
|
7
|
-
|
8
|
-
-
|
9
|
-
|
10
|
-
|
9
|
+
### Removed
|
10
|
+
- Unused docker image for rabbitMQ (only for development purposes)
|
11
|
+
|
12
|
+
## [0.3.0] - 2023-11-29
|
13
|
+
|
14
|
+
### Added
|
15
|
+
|
16
|
+
- Introduce github action for building, linting and running specs anytime a pull request is opened or push to master happens
|
11
17
|
|
12
18
|
## [0.2.0] - 2023-11-28
|
13
19
|
|
14
20
|
### Added
|
15
21
|
|
16
22
|
- Introduce github action for releasing the gem once is merged into master
|
23
|
+
|
24
|
+
## [0.1.0] - 2023-11-27
|
25
|
+
|
26
|
+
### Added
|
27
|
+
|
28
|
+
- Support to express publishing through any kind of exchanges
|
29
|
+
- Capability to subscribe to queues
|
30
|
+
- Express RabbitMQ topology separated from the responsibility of publishing or subscribing
|
31
|
+
- Provide dedicated Ruby process to consume messages through the subscribers defined
|
data/README.md
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
# Harmoniser
|
2
2
|
|
3
|
-
|
3
|
+
[](https://badge.fury.io/rb/harmoniser)
|
4
|
+

|
5
|
+
|
6
|
+
A minimalistic approach to communicating with RabbitMQ.
|
4
7
|
|
5
8
|
Harmoniser uses [Bunny](https://github.com/ruby-amqp/bunny) as a low level library to communicate with RabbitMQ in order to integrate publishing and messages consuming.
|
6
9
|
|
@@ -122,7 +125,6 @@ You can also shell into the running container by executing `$ make shell` and fr
|
|
122
125
|
- [ ] Chore: Introduce simplecov gem for code coverage.
|
123
126
|
- [ ] Feature: Add sensible defaults for Session options like heartbeat, timeout, recovery_completed or recovery_attempt_started.
|
124
127
|
- [ ] Feature: Add default `on_return` handler as well as permitting the definition of on_return method to be called anytime a published message gets returned.
|
125
|
-
- [ ] Feature: Add default `on_error` and `on_uncaught_exception` as well as permitting the definition of them to be called anytime an error in the channel occurs or error in the consumer handler happens.
|
126
128
|
- [ ] Feature: Introduce capability of configuring number of threads for queue consuming at the CLI.
|
127
129
|
|
128
130
|
## License
|
data/harmoniser.gemspec
CHANGED
@@ -8,11 +8,11 @@ Gem::Specification.new do |spec|
|
|
8
8
|
spec.authors = ["Jose Lloret"]
|
9
9
|
spec.email = ["jollopre@gmail.com"]
|
10
10
|
|
11
|
-
spec.summary = "A minimalistic approach to
|
12
|
-
spec.description = "A declarative approach to
|
11
|
+
spec.summary = "A minimalistic approach to communicating with RabbitMQ"
|
12
|
+
spec.description = "A declarative approach to communicating with RabbitMQ that makes it easy to integrate publishing and consuming messages"
|
13
13
|
spec.homepage = "https://github.com/jollopre/harmoniser"
|
14
14
|
spec.license = "MIT"
|
15
|
-
spec.required_ruby_version = ">= 2
|
15
|
+
spec.required_ruby_version = ">= 3.2"
|
16
16
|
|
17
17
|
spec.metadata = {
|
18
18
|
"homepage_uri" => spec.homepage,
|
@@ -26,6 +26,6 @@ Gem::Specification.new do |spec|
|
|
26
26
|
|
27
27
|
spec.add_runtime_dependency "bunny", "~> 2.22"
|
28
28
|
spec.add_development_dependency "rake", "~> 13.0"
|
29
|
-
spec.add_development_dependency "rspec", "~> 3
|
29
|
+
spec.add_development_dependency "rspec", "~> 3"
|
30
30
|
spec.add_development_dependency "standardrb", "~> 1.0"
|
31
31
|
end
|
@@ -11,8 +11,20 @@ module Harmoniser
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def create_channel
|
14
|
-
|
15
|
-
|
14
|
+
channel = Harmoniser.connection.create_channel
|
15
|
+
channel.on_error(&method(:on_error).to_proc)
|
16
|
+
channel.on_uncaught_exception(&method(:on_uncaught_exception).to_proc)
|
17
|
+
channel
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def on_error(channel, amq_method)
|
23
|
+
Harmoniser.logger.error("Default on_error handler executed for channel: method = `#{amq_method}`, exchanges = `#{channel.exchanges.keys}`, queues = `#{channel.queues.keys}`")
|
24
|
+
end
|
25
|
+
|
26
|
+
def on_uncaught_exception(error, consumer)
|
27
|
+
Harmoniser.logger.error("Default on_uncaught_exception handler executed for channel: error_class = `#{error.class}`, error_message = `#{error.message}`, error_backtrace = `#{error.backtrace&.first(5)}, queue = `#{consumer.queue}`")
|
16
28
|
end
|
17
29
|
end
|
18
30
|
|
@@ -20,14 +20,14 @@ module Harmoniser
|
|
20
20
|
}
|
21
21
|
MUTEX = Mutex.new
|
22
22
|
|
23
|
-
attr_reader :
|
23
|
+
attr_reader :connection_opts, :logger, :options
|
24
24
|
def_delegators :options, :environment, :require, :verbose
|
25
25
|
|
26
26
|
def initialize
|
27
27
|
@logger = Logger.new($stdout, progname: "harmoniser@#{VERSION}")
|
28
28
|
@options = Options.new(**default_options)
|
29
29
|
set_logger_severity
|
30
|
-
@connection_opts = DEFAULT_CONNECTION_OPTS.merge({
|
30
|
+
@connection_opts = DEFAULT_CONNECTION_OPTS.merge({logger: @logger})
|
31
31
|
@topology = Topology.new
|
32
32
|
end
|
33
33
|
|
@@ -39,7 +39,7 @@ module Harmoniser
|
|
39
39
|
|
40
40
|
def connection
|
41
41
|
MUTEX.synchronize do
|
42
|
-
@connection
|
42
|
+
@connection ||= Connection.new(connection_opts)
|
43
43
|
@connection.start unless @connection.open?
|
44
44
|
@connection
|
45
45
|
end
|
@@ -51,8 +51,8 @@ module Harmoniser
|
|
51
51
|
@connection_opts = connection_opts.merge(opts)
|
52
52
|
end
|
53
53
|
|
54
|
-
def options_with(**
|
55
|
-
@options = options.with(**
|
54
|
+
def options_with(**)
|
55
|
+
@options = options.with(**)
|
56
56
|
set_logger_severity
|
57
57
|
end
|
58
58
|
|
@@ -67,10 +67,10 @@ module Harmoniser
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def set_logger_severity
|
70
|
-
if @options.production?
|
71
|
-
@
|
70
|
+
@logger.level = if @options.production?
|
71
|
+
@options.verbose? ? Logger::DEBUG : Logger::INFO
|
72
72
|
else
|
73
|
-
|
73
|
+
Logger::DEBUG
|
74
74
|
end
|
75
75
|
end
|
76
76
|
end
|
data/lib/harmoniser/launcher.rb
CHANGED
@@ -34,7 +34,7 @@ module Harmoniser
|
|
34
34
|
end
|
35
35
|
|
36
36
|
def stop_subscribers
|
37
|
-
@logger.info("Connection will be closed: connection = `#{@configuration.connection
|
37
|
+
@logger.info("Connection will be closed: connection = `#{@configuration.connection}`")
|
38
38
|
@configuration.connection.close
|
39
39
|
end
|
40
40
|
|
data/lib/harmoniser/publisher.rb
CHANGED
@@ -3,7 +3,7 @@ require "harmoniser/definition"
|
|
3
3
|
|
4
4
|
module Harmoniser
|
5
5
|
module Publisher
|
6
|
-
class MissingExchangeDefinition < StandardError
|
6
|
+
class MissingExchangeDefinition < StandardError; end
|
7
7
|
include Channelable
|
8
8
|
MUTEX = Mutex.new
|
9
9
|
private_constant :MUTEX
|
@@ -13,7 +13,7 @@ module Harmoniser
|
|
13
13
|
@harmoniser_exchange_definition = Definition::Exchange.new(
|
14
14
|
name: exchange_name,
|
15
15
|
type: nil,
|
16
|
-
opts: {
|
16
|
+
opts: {passive: true}
|
17
17
|
)
|
18
18
|
end
|
19
19
|
|
data/lib/harmoniser/topology.rb
CHANGED
data/lib/harmoniser/version.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.4.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: 2023-
|
11
|
+
date: 2023-12-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '3
|
47
|
+
version: '3'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '3
|
54
|
+
version: '3'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: standardrb
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,8 +66,8 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '1.0'
|
69
|
-
description: A declarative approach to
|
70
|
-
|
69
|
+
description: A declarative approach to communicating with RabbitMQ that makes it easy
|
70
|
+
to integrate publishing and consuming messages
|
71
71
|
email:
|
72
72
|
- jollopre@gmail.com
|
73
73
|
executables:
|
@@ -114,7 +114,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
114
|
requirements:
|
115
115
|
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2
|
117
|
+
version: '3.2'
|
118
118
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
119
|
requirements:
|
120
120
|
- - ">="
|
@@ -124,5 +124,5 @@ requirements: []
|
|
124
124
|
rubygems_version: 3.4.10
|
125
125
|
signing_key:
|
126
126
|
specification_version: 4
|
127
|
-
summary: A minimalistic approach to
|
127
|
+
summary: A minimalistic approach to communicating with RabbitMQ
|
128
128
|
test_files: []
|