manageiq-messaging 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yaml +1 -0
- data/CHANGELOG.md +9 -0
- data/lib/manageiq/messaging/client.rb +6 -0
- data/lib/manageiq/messaging/kafka/client.rb +10 -8
- data/lib/manageiq/messaging/kafka/common.rb +17 -1
- 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 +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfe85cf657f8c2c1abbe3c4e89fbaddb02339972f0c93c2e325b5eadba10b456
|
4
|
+
data.tar.gz: 5e28a2cc86fa33a89893cad6652aa20acd5af801f5061c5a2c0632668f1c94c8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a20dad2e6813bdacfc24ebfb81a9edff1ae37156de353c307d8e403cb27915a4da928872feff00cb157fb8aa5539e67d024afc20c7ceaba79f68ea564cbbdd27
|
7
|
+
data.tar.gz: 786daacf2af78548fe5695e38d36083b21e1c9bedfe13977d287a5b8f1ae5f22d58f5b379ca40144382873e08b120acb0bebf2835cfda0d7eee67e556c085aee
|
data/.github/workflows/ci.yaml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -6,6 +6,15 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
|
|
6
6
|
|
7
7
|
## [Unreleased]
|
8
8
|
|
9
|
+
## [1.2.0] - 19-Oct-2022
|
10
|
+
|
11
|
+
* Add ssl and ca_file options to `Client.open` [#76](https://github.com/ManageIQ/manageiq-messaging/pull/76)
|
12
|
+
* Add wait_for_topic option to Kafka [#75](https://github.com/ManageIQ/manageiq-messaging/pull/75)
|
13
|
+
|
14
|
+
## [1.1.2] - 6-Oct-2022
|
15
|
+
|
16
|
+
* Fix kafka publish_topic on ruby3 [#74](https://github.com/ManageIQ/manageiq-messaging/pull/74)
|
17
|
+
|
9
18
|
## [1.1.1] - 6-May-2022
|
10
19
|
|
11
20
|
* Ruby 3.0 support [#71](https://github.com/ManageIQ/manageiq-messaging/pull/71)
|
@@ -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,14 @@ 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[:"ssl.ca.location"] = options[:ca_file] if options[:ca_file]
|
95
|
+
result[:"security.protocol"] = !!options[:ssl] ? "SASL_SSL" : "PLAINTEXT"
|
96
|
+
|
97
|
+
result.merge(options.except(:port, :host, :hosts, :encoding, :protocol, :client_ref, :username, :password, :ssl, :ca_file))
|
96
98
|
end
|
97
99
|
end
|
98
100
|
end
|
@@ -23,7 +23,7 @@ module ManageIQ
|
|
23
23
|
|
24
24
|
def raw_publish(body, options)
|
25
25
|
options[:payload] = encode_body(options[:headers], body)
|
26
|
-
producer.produce(options)
|
26
|
+
producer.produce(**options)
|
27
27
|
end
|
28
28
|
|
29
29
|
def queue_for_publish(options)
|
@@ -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.2.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: 2022-
|
11
|
+
date: 2022-10-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -197,7 +197,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
197
197
|
- !ruby/object:Gem::Version
|
198
198
|
version: '0'
|
199
199
|
requirements: []
|
200
|
-
rubygems_version: 3.3.
|
200
|
+
rubygems_version: 3.3.15
|
201
201
|
signing_key:
|
202
202
|
specification_version: 4
|
203
203
|
summary: Client library for ManageIQ components to exchange messages through its internal
|