amqp-client 1.1.1 → 1.1.2
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/.github/workflows/main.yml +2 -1
- data/.rubocop_todo.yml +29 -12
- data/CHANGELOG.md +4 -0
- data/README.md +2 -0
- data/lib/amqp/client/connection.rb +16 -9
- data/lib/amqp/client/properties.rb +5 -2
- data/lib/amqp/client/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: baa9c2034e80f56aa375a7abb7394109d2f4e84e4a4c04ae8bcb053d299d6dcc
|
4
|
+
data.tar.gz: 7857e1d6ddf96a64df664956da02eac2098fe144a5d2eea1364bd14ba5d41b7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4deaecc1cdce66be71316e3046c5df0832c20a876ad0d3f5884c6e6313ece2d7fad8262f8ee83daad78500ca411648618642eb551c63279e8b84ec727d1f5633
|
7
|
+
data.tar.gz: 4136f5ce5c98610361a673f348fd531a93c34c7989275e7858bfc9694d7368adcbd17beb910fae30cd1fceb29163b7411d4ee0dc235f9c655bfdf960a9de4602
|
data/.github/workflows/main.yml
CHANGED
@@ -19,7 +19,7 @@ jobs:
|
|
19
19
|
strategy:
|
20
20
|
fail-fast: false
|
21
21
|
matrix:
|
22
|
-
ruby: ['2.6', '2.7', '3.0']
|
22
|
+
ruby: ['2.6', '2.7', '3.0', 'jruby', 'truffleruby']
|
23
23
|
steps:
|
24
24
|
- uses: actions/checkout@v2
|
25
25
|
- name: Set up Ruby
|
@@ -31,4 +31,5 @@ jobs:
|
|
31
31
|
bundle install
|
32
32
|
bundle exec rake
|
33
33
|
env:
|
34
|
+
TESTOPTS: --exclude=/_tls$/
|
34
35
|
AMQP_PORT: ${{ job.services.rabbitmq.ports[5672] }}
|
data/.rubocop_todo.yml
CHANGED
@@ -1,15 +1,27 @@
|
|
1
1
|
# This configuration was generated by
|
2
2
|
# `rubocop --auto-gen-config`
|
3
|
-
# on 2021-
|
3
|
+
# on 2021-10-15 13:44:24 UTC using RuboCop version 1.19.1.
|
4
4
|
# The point is for the user to remove these configuration records
|
5
5
|
# one by one as the offenses are removed from the code base.
|
6
6
|
# Note that changes in the inspected code, or installation of new
|
7
7
|
# versions of RuboCop, may require this file to be generated again.
|
8
8
|
|
9
|
-
# Offense count:
|
9
|
+
# Offense count: 1
|
10
|
+
# Cop supports --auto-correct.
|
11
|
+
# Configuration parameters: AutoCorrect, AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, IgnoredPatterns.
|
12
|
+
# URISchemes: http, https
|
13
|
+
Layout/LineLength:
|
14
|
+
Max: 132
|
15
|
+
|
16
|
+
# Offense count: 1
|
17
|
+
Lint/RescueException:
|
18
|
+
Exclude:
|
19
|
+
- 'lib/amqp/client/connection.rb'
|
20
|
+
|
21
|
+
# Offense count: 32
|
10
22
|
# Configuration parameters: IgnoredMethods, CountRepeatedAttributes.
|
11
23
|
Metrics/AbcSize:
|
12
|
-
Max:
|
24
|
+
Max: 175
|
13
25
|
|
14
26
|
# Offense count: 1
|
15
27
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
@@ -22,27 +34,32 @@ Metrics/BlockLength:
|
|
22
34
|
Metrics/BlockNesting:
|
23
35
|
Max: 4
|
24
36
|
|
25
|
-
# Offense count:
|
37
|
+
# Offense count: 6
|
26
38
|
# Configuration parameters: CountComments, CountAsOne.
|
27
39
|
Metrics/ClassLength:
|
28
|
-
Max:
|
40
|
+
Max: 497
|
29
41
|
|
30
|
-
# Offense count:
|
42
|
+
# Offense count: 10
|
31
43
|
# Configuration parameters: IgnoredMethods.
|
32
44
|
Metrics/CyclomaticComplexity:
|
33
|
-
Max:
|
45
|
+
Max: 46
|
34
46
|
|
35
|
-
# Offense count:
|
47
|
+
# Offense count: 67
|
36
48
|
# Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
|
37
49
|
Metrics/MethodLength:
|
38
|
-
Max:
|
50
|
+
Max: 169
|
39
51
|
|
40
52
|
# Offense count: 2
|
41
53
|
# Configuration parameters: CountComments, CountAsOne.
|
42
54
|
Metrics/ModuleLength:
|
43
|
-
Max:
|
55
|
+
Max: 486
|
56
|
+
|
57
|
+
# Offense count: 1
|
58
|
+
# Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
|
59
|
+
Metrics/ParameterLists:
|
60
|
+
Max: 13
|
44
61
|
|
45
|
-
# Offense count:
|
62
|
+
# Offense count: 5
|
46
63
|
# Configuration parameters: IgnoredMethods.
|
47
64
|
Metrics/PerceivedComplexity:
|
48
|
-
Max:
|
65
|
+
Max: 23
|
data/CHANGELOG.md
CHANGED
data/README.md
CHANGED
@@ -133,9 +133,13 @@ module AMQP
|
|
133
133
|
warn "AMQP-Client blocked by broker: #{blocked}" if blocked
|
134
134
|
@write_lock.synchronize do
|
135
135
|
warn "AMQP-Client unblocked by broker" if blocked
|
136
|
-
|
136
|
+
if RUBY_ENGINE == "truffleruby"
|
137
|
+
bytes.each { |b| @socket.write b }
|
138
|
+
else
|
139
|
+
@socket.write(*bytes)
|
140
|
+
end
|
137
141
|
end
|
138
|
-
rescue
|
142
|
+
rescue *READ_EXCEPTIONS => e
|
139
143
|
raise Error::ConnectionClosed.new(*@closed) if @closed
|
140
144
|
|
141
145
|
raise Error, "Could not write to socket, #{e.message}"
|
@@ -152,12 +156,12 @@ module AMQP
|
|
152
156
|
frame_start = String.new(capacity: 7)
|
153
157
|
frame_buffer = String.new(capacity: frame_max)
|
154
158
|
loop do
|
155
|
-
socket.read(7, frame_start)
|
159
|
+
socket.read(7, frame_start) || raise(IOError)
|
156
160
|
type, channel_id, frame_size = frame_start.unpack("C S> L>")
|
157
161
|
frame_max >= frame_size || raise(Error, "Frame size #{frame_size} larger than negotiated max frame size #{frame_max}")
|
158
162
|
|
159
163
|
# read the frame content
|
160
|
-
socket.read(frame_size, frame_buffer)
|
164
|
+
socket.read(frame_size, frame_buffer) || raise(IOError)
|
161
165
|
|
162
166
|
# make sure that the frame end is correct
|
163
167
|
frame_end = socket.readchar.ord
|
@@ -167,7 +171,7 @@ module AMQP
|
|
167
171
|
parse_frame(type, channel_id, frame_buffer) || return
|
168
172
|
end
|
169
173
|
nil
|
170
|
-
rescue
|
174
|
+
rescue *READ_EXCEPTIONS => e
|
171
175
|
@closed ||= [400, "read error: #{e.message}"]
|
172
176
|
nil # ignore read errors
|
173
177
|
ensure
|
@@ -177,13 +181,16 @@ module AMQP
|
|
177
181
|
@write_lock.synchronize do
|
178
182
|
@socket.close
|
179
183
|
end
|
180
|
-
rescue
|
184
|
+
rescue *READ_EXCEPTIONS
|
181
185
|
nil
|
182
186
|
end
|
183
187
|
end
|
184
188
|
|
185
189
|
private
|
186
190
|
|
191
|
+
READ_EXCEPTIONS = [IOError, OpenSSL::OpenSSLError, SystemCallError,
|
192
|
+
RUBY_ENGINE == "jruby" ? java.lang.NullPointerException : nil].compact.freeze
|
193
|
+
|
187
194
|
def parse_frame(type, channel_id, buf)
|
188
195
|
case type
|
189
196
|
when 1 # method frame
|
@@ -402,7 +409,7 @@ module AMQP
|
|
402
409
|
loop do
|
403
410
|
begin
|
404
411
|
socket.readpartial(4096, buf)
|
405
|
-
rescue
|
412
|
+
rescue *READ_EXCEPTIONS => e
|
406
413
|
raise Error, "Could not establish AMQP connection: #{e.message}"
|
407
414
|
end
|
408
415
|
|
@@ -444,10 +451,10 @@ module AMQP
|
|
444
451
|
else raise Error, "Unexpected frame type: #{type}"
|
445
452
|
end
|
446
453
|
end
|
447
|
-
rescue
|
454
|
+
rescue Exception => e
|
448
455
|
begin
|
449
456
|
socket.close
|
450
|
-
rescue
|
457
|
+
rescue *READ_EXCEPTIONS
|
451
458
|
nil
|
452
459
|
end
|
453
460
|
raise e
|
@@ -6,8 +6,10 @@ module AMQP
|
|
6
6
|
class Client
|
7
7
|
# Encode/decode AMQP Properties
|
8
8
|
class Properties
|
9
|
-
|
10
|
-
|
9
|
+
# rubocop:disable Metrics/ParameterLists
|
10
|
+
def initialize(content_type: nil, content_encoding: nil, headers: nil, delivery_mode: nil,
|
11
|
+
priority: nil, correlation_id: nil, reply_to: nil, expiration: nil,
|
12
|
+
message_id: nil, timestamp: nil, type: nil, user_id: nil, app_id: nil)
|
11
13
|
@content_type = content_type
|
12
14
|
@content_encoding = content_encoding
|
13
15
|
@headers = headers
|
@@ -22,6 +24,7 @@ module AMQP
|
|
22
24
|
@user_id = user_id
|
23
25
|
@app_id = app_id
|
24
26
|
end
|
27
|
+
# rubocop:enable Metrics/ParameterLists
|
25
28
|
|
26
29
|
# Properties as a Hash
|
27
30
|
# @return [Hash] Properties
|
data/lib/amqp/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amqp-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Carl Hörberg
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Work in progress
|
14
14
|
email:
|