manageiq-messaging 1.1.2 → 1.3.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 +12 -1
- data/lib/manageiq/messaging/client.rb +6 -0
- data/lib/manageiq/messaging/kafka/client.rb +12 -8
- data/lib/manageiq/messaging/kafka/common.rb +16 -0
- data/lib/manageiq/messaging/kafka/queue.rb +9 -4
- data/lib/manageiq/messaging/kafka/topic.rb +10 -4
- data/lib/manageiq/messaging/stomp/client.rb +1 -1
- data/lib/manageiq/messaging/version.rb +1 -1
- 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: b0f15797e5132dab8e6e37ca495eb1c0018b665c853c9e042f472d7b6ff1fa8a
|
4
|
+
data.tar.gz: 26c517dac36367c0c1e707618f02c1ccc0622a0f4ba2cea585d84e9020fa1c00
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 777d39d0123ffd98a5bdb5d7b1e82f7642089f12489ee56ccbe4463a01b8d5371c26b62663815ff3e8bcfdf213f08917bb3fd04154f137ff45039b425c441b60
|
7
|
+
data.tar.gz: 8e9002b7f3f4f60240baa7eb7ed1cfb3b8e1da6bc18830ff3d7edc98c0cd9f7bed2f24c3d6a514ecc067c0b78d637f5765897dc121c92f9cfa00aeb09b3dc984
|
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,14 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.3.0] - 03-Apr-2023
|
10
|
+
* Add Kafka SSL keystore options to client [#77](https://github.com/ManageIQ/manageiq-messaging/pull/77)
|
11
|
+
|
12
|
+
## [1.2.0] - 19-Oct-2022
|
13
|
+
|
14
|
+
* Add ssl and ca_file options to `Client.open` [#76](https://github.com/ManageIQ/manageiq-messaging/pull/76)
|
15
|
+
* Add wait_for_topic option to Kafka [#75](https://github.com/ManageIQ/manageiq-messaging/pull/75)
|
16
|
+
|
9
17
|
## [1.1.2] - 6-Oct-2022
|
10
18
|
|
11
19
|
* Fix kafka publish_topic on ruby3 [#74](https://github.com/ManageIQ/manageiq-messaging/pull/74)
|
@@ -68,7 +76,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
68
76
|
|
69
77
|
* Initial release
|
70
78
|
|
71
|
-
[Unreleased]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.
|
79
|
+
[Unreleased]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.3.0...HEAD
|
80
|
+
[1.3.0]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.2.0...v1.3.0
|
81
|
+
[1.2.0]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.1.2...v1.2.0
|
82
|
+
[1.1.2]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.1.1...v1.1.2
|
72
83
|
[1.1.1]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.1.0...v1.1.1
|
73
84
|
[1.1.0]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.0.3...v1.1.0
|
74
85
|
[1.0.3]: https://github.com/ManageIQ/manageiq-messaging/compare/v1.0.2...v1.0.3
|
@@ -33,6 +33,12 @@ module ManageIQ
|
|
33
33
|
# Open or create a connection to the message broker.
|
34
34
|
# Expected +options+ keys are:
|
35
35
|
# * :protocol (Implemented: 'Stomp', 'Kafka'. Default 'Stomp')
|
36
|
+
# * :host (hostname or IP address of the messaging broker)
|
37
|
+
# * :port (host port number)
|
38
|
+
# * :username (optional)
|
39
|
+
# * :password (optional)
|
40
|
+
# * :ssl (true/false)
|
41
|
+
# * :ca_file (optional. path to a certificate authority cert)
|
36
42
|
# * :encoding ('yaml' or 'json'. Default 'yaml')
|
37
43
|
# Other connection options are underlying messaging system specific.
|
38
44
|
#
|
@@ -8,13 +8,11 @@ module ManageIQ
|
|
8
8
|
# Kafka specific connection options accepted by +open+ method:
|
9
9
|
# * :client_ref (A reference string to identify the client)
|
10
10
|
# * :hosts (Array of Kafka cluster hosts, or)
|
11
|
-
# * :host (Single host name)
|
12
|
-
# * :port (host port number)
|
13
11
|
#
|
14
|
-
# For additional security options, please refer to
|
12
|
+
# For additional security options, please refer to
|
15
13
|
# https://github.com/edenhill/librdkafka/wiki/Using-SSL-with-librdkafka and
|
16
|
-
# https://github.com/edenhill/librdkafka/wiki/Using-SASL-with-librdkafka
|
17
|
-
#
|
14
|
+
# https://github.com/edenhill/librdkafka/wiki/Using-SASL-with-librdkafka
|
15
|
+
#
|
18
16
|
#
|
19
17
|
# Kafka specific +publish_message+ options:
|
20
18
|
# * :group_name (Used as Kafka partition_key)
|
@@ -89,10 +87,16 @@ module ManageIQ
|
|
89
87
|
|
90
88
|
result = {:"bootstrap.servers" => hosts.join(',')}
|
91
89
|
result[:"client.id"] = options[:client_ref] if options[:client_ref]
|
92
|
-
result[:"sasl.username"] = options[:username] if options[:username]
|
93
|
-
result[:"sasl.password"] = options[:password] if options[:password]
|
94
90
|
|
95
|
-
result.
|
91
|
+
result[:"sasl.mechanism"] = "PLAIN"
|
92
|
+
result[:"sasl.username"] = options[:username] if options[:username]
|
93
|
+
result[:"sasl.password"] = options[:password] if options[:password]
|
94
|
+
result[:"security.protocol"] = !!options[:ssl] ? "SASL_SSL" : "PLAINTEXT"
|
95
|
+
result[:"ssl.ca.location"] = options[:ca_file] if options[:ca_file]
|
96
|
+
result[:"ssl.keystore.location"] = options[:keystore_location] if options[:keystore_location]
|
97
|
+
result[:"ssl.keystore.password"] = options[:keystore_password] if options[:keystore_password]
|
98
|
+
|
99
|
+
result.merge(options.except(:port, :host, :hosts, :encoding, :protocol, :client_ref, :username, :password, :ssl, :ca_file, :keystore_location, :keystore_password))
|
96
100
|
end
|
97
101
|
end
|
98
102
|
end
|
@@ -94,6 +94,22 @@ module ManageIQ
|
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
97
|
+
def wait_for_topic(wait = true)
|
98
|
+
retry_count = 0
|
99
|
+
maximum_backoff = 300
|
100
|
+
|
101
|
+
begin
|
102
|
+
yield
|
103
|
+
rescue Rdkafka::RdkafkaError => err
|
104
|
+
raise if err.code != :unknown_topic_or_part || !wait
|
105
|
+
|
106
|
+
retry_count += 1
|
107
|
+
sleep([1.5 * retry_count, maximum_backoff].min)
|
108
|
+
|
109
|
+
retry
|
110
|
+
end
|
111
|
+
end
|
112
|
+
|
97
113
|
def message_header_keys
|
98
114
|
[:sender, :message_type, :class_name]
|
99
115
|
end
|
@@ -17,13 +17,18 @@ module ManageIQ
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def subscribe_messages_impl(options, &block)
|
20
|
+
wait = options.delete(:wait_for_topic)
|
21
|
+
wait = true if wait.nil?
|
22
|
+
|
20
23
|
topic = address(options)
|
21
24
|
options[:persist_ref] = GROUP_FOR_QUEUE_MESSAGES + topic
|
22
25
|
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
26
|
+
wait_for_topic(wait) do
|
27
|
+
queue_consumer = consumer(true, options)
|
28
|
+
queue_consumer.subscribe(topic)
|
29
|
+
queue_consumer.each do |message|
|
30
|
+
process_queue_message(queue_consumer, topic, message, &block)
|
31
|
+
end
|
27
32
|
end
|
28
33
|
end
|
29
34
|
end
|
@@ -14,13 +14,19 @@ module ManageIQ
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def subscribe_topic_impl(options, &block)
|
17
|
+
wait = options.delete(:wait_for_topic)
|
18
|
+
wait = true if wait.nil?
|
19
|
+
|
17
20
|
topic = address(options)
|
18
21
|
|
19
22
|
options[:persist_ref] = "#{GROUP_FOR_ADHOC_LISTENERS}_#{Time.now.to_i}" unless options[:persist_ref]
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
23
|
+
|
24
|
+
wait_for_topic(wait) do
|
25
|
+
topic_consumer = consumer(false, options)
|
26
|
+
topic_consumer.subscribe(topic)
|
27
|
+
topic_consumer.each do |message|
|
28
|
+
process_topic_message(topic_consumer, topic, message, &block)
|
29
|
+
end
|
24
30
|
end
|
25
31
|
end
|
26
32
|
end
|
@@ -61,7 +61,7 @@ module ManageIQ
|
|
61
61
|
attr_reader :stomp_client
|
62
62
|
|
63
63
|
def initialize(options)
|
64
|
-
host = options.slice(:host, :port)
|
64
|
+
host = options.slice(:host, :port, :ssl)
|
65
65
|
host[:passcode] = options[:password] if options[:password]
|
66
66
|
host[:login] = options[:username] if options[:username]
|
67
67
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: manageiq-messaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ManageIQ Authors
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|