amqp-client 1.1.1 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e248898d176ad9c3d785226ed37c0335052ef701ee16a16bff483089be65dd8
4
- data.tar.gz: 89b58399edb11b30b05db86e9e4b0a617438e3ed52e63b3e76ae3a4c8cb361fc
3
+ metadata.gz: baa9c2034e80f56aa375a7abb7394109d2f4e84e4a4c04ae8bcb053d299d6dcc
4
+ data.tar.gz: 7857e1d6ddf96a64df664956da02eac2098fe144a5d2eea1364bd14ba5d41b7c
5
5
  SHA512:
6
- metadata.gz: 4500bec819ea9de9546f001eed682ac040ea3c2f93904dabb24afdbbda966d3352d8b1e33687a82c482ce835e7d650172dd906d9ef4ec2efc17f1dea31947314
7
- data.tar.gz: 62ea49dc2782122146dd2613cd51b1c4132b3eef9d48c5573e9369b0af96042018f104a84cfe2aa2f173cf6d10f5ca3e427baa3ef61faed7029cd7328148a762
6
+ metadata.gz: 4deaecc1cdce66be71316e3046c5df0832c20a876ad0d3f5884c6e6313ece2d7fad8262f8ee83daad78500ca411648618642eb551c63279e8b84ec727d1f5633
7
+ data.tar.gz: 4136f5ce5c98610361a673f348fd531a93c34c7989275e7858bfc9694d7368adcbd17beb910fae30cd1fceb29163b7411d4ee0dc235f9c655bfdf960a9de4602
@@ -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-09-06 19:39:47 UTC using RuboCop version 1.19.1.
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: 18
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: 179
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: 5
37
+ # Offense count: 6
26
38
  # Configuration parameters: CountComments, CountAsOne.
27
39
  Metrics/ClassLength:
28
- Max: 400
40
+ Max: 497
29
41
 
30
- # Offense count: 9
42
+ # Offense count: 10
31
43
  # Configuration parameters: IgnoredMethods.
32
44
  Metrics/CyclomaticComplexity:
33
- Max: 44
45
+ Max: 46
34
46
 
35
- # Offense count: 40
47
+ # Offense count: 67
36
48
  # Configuration parameters: CountComments, CountAsOne, ExcludedMethods, IgnoredMethods.
37
49
  Metrics/MethodLength:
38
- Max: 170
50
+ Max: 169
39
51
 
40
52
  # Offense count: 2
41
53
  # Configuration parameters: CountComments, CountAsOne.
42
54
  Metrics/ModuleLength:
43
- Max: 500
55
+ Max: 486
56
+
57
+ # Offense count: 1
58
+ # Configuration parameters: CountKeywordArgs, MaxOptionalParameters.
59
+ Metrics/ParameterLists:
60
+ Max: 13
44
61
 
45
- # Offense count: 4
62
+ # Offense count: 5
46
63
  # Configuration parameters: IgnoredMethods.
47
64
  Metrics/PerceivedComplexity:
48
- Max: 22
65
+ Max: 23
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [1.1.2] - 2021-10-15
4
+
5
+ - Added: Support for JRuby and TruffleRuby
6
+
3
7
  ## [1.1.1] - 2021-09-15
4
8
 
5
9
  - Added: Examples in the documentation
data/README.md CHANGED
@@ -83,6 +83,8 @@ All maintained Ruby versions are supported.
83
83
  - 3.0
84
84
  - 2.7
85
85
  - 2.6
86
+ - jruby
87
+ - truffleruby
86
88
 
87
89
  ## Installation
88
90
 
@@ -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
- @socket.write(*bytes)
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 IOError, OpenSSL::OpenSSLError, SystemCallError => e
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 IOError, OpenSSL::OpenSSLError, SystemCallError => e
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 IOError, OpenSSL::OpenSSLError, SystemCallError
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 IOError, OpenSSL::OpenSSLError, SystemCallError => e
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 StandardError => e
454
+ rescue Exception => e
448
455
  begin
449
456
  socket.close
450
- rescue IOError, OpenSSL::OpenSSLError, SystemCallError
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
- def initialize(content_type: nil, content_encoding: nil, headers: nil, delivery_mode: nil, priority: nil, correlation_id: nil,
10
- reply_to: nil, expiration: nil, message_id: nil, timestamp: nil, type: nil, user_id: nil, app_id: nil)
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
@@ -3,6 +3,6 @@
3
3
  module AMQP
4
4
  class Client
5
5
  # Version of the client library
6
- VERSION = "1.1.1"
6
+ VERSION = "1.1.2"
7
7
  end
8
8
  end
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.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-09-15 00:00:00.000000000 Z
11
+ date: 2021-10-15 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Work in progress
14
14
  email: