protobuf-nats 0.10.1 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +9 -1
- data/README.md +3 -1
- data/ext/jars/jnats-1.1-SNAPSHOT.jar +0 -0
- data/lib/protobuf/nats/client.rb +10 -4
- data/lib/protobuf/nats/config.rb +6 -1
- data/lib/protobuf/nats/errors.rb +3 -3
- data/lib/protobuf/nats/jnats.rb +3 -8
- data/lib/protobuf/nats/version.rb +1 -1
- data/protobuf-nats.gemspec +2 -2
- data/scripts/install_gnatsd.sh +20 -0
- metadata +12 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c0f99feffeb6c233028cc0f6ef5a3a3193e8e5974e69b31a45ef0779e240d57
|
4
|
+
data.tar.gz: a296bec5b07fb71d713a5e92f3de90b11f19f1f63c929649cbec2f666be7a9b7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c792b9b7efc00fa9e430e63ac84cf9f36586475a84007a47df426fd42b16da5cb6eaf419ba0badc1e05b61a049378322c2f70d7b9eddc17392bedd58c8702386
|
7
|
+
data.tar.gz: 9438620b728b973db2e5a343052ad033d7cc78bb10c48c0b3c2d676114e8f2af8b2dd94fbfac4d39eed0f17e643b574cd0c86b50ecbd7722e0d5cc29c868d060
|
data/.travis.yml
CHANGED
@@ -1,8 +1,16 @@
|
|
1
1
|
sudo: false
|
2
2
|
language: ruby
|
3
|
+
jdk:
|
4
|
+
- openjdk8
|
3
5
|
rvm:
|
4
6
|
- 2.3.0
|
7
|
+
- 2.7.0
|
5
8
|
- jruby-9.1.7.0
|
9
|
+
- jruby-9.2.13.0
|
6
10
|
before_install:
|
7
|
-
|
11
|
+
# Install and start gnatsd
|
12
|
+
- ./scripts/install_gnatsd.sh
|
13
|
+
- $HOME/nats-server/nats-server &
|
14
|
+
# Install deps for project
|
15
|
+
- gem install bundler
|
8
16
|
- gem update --system
|
data/README.md
CHANGED
@@ -154,9 +154,11 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
|
154
154
|
|
155
155
|
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
156
156
|
|
157
|
+
The java-nats client is temporarily forked to support jruby > 9.2.10.0. The living branch for that is here: https://github.com/film42/java-nats/tree/jruby-compat. This will be removed when we upgrade to the new nats.java client.
|
158
|
+
|
157
159
|
## Contributing
|
158
160
|
|
159
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
161
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/mxenabled/protobuf-nats.
|
160
162
|
|
161
163
|
|
162
164
|
## License
|
Binary file
|
data/lib/protobuf/nats/client.rb
CHANGED
@@ -151,12 +151,12 @@ module Protobuf
|
|
151
151
|
when :ack_timeout
|
152
152
|
::ActiveSupport::Notifications.instrument "client.request_timeout.protobuf-nats"
|
153
153
|
next if (retries -= 1) > 0
|
154
|
-
raise ::Protobuf::Nats::Errors::RequestTimeout
|
154
|
+
raise ::Protobuf::Nats::Errors::RequestTimeout, formatted_service_and_method_name
|
155
155
|
when :nack
|
156
156
|
::ActiveSupport::Notifications.instrument "client.request_nack.protobuf-nats"
|
157
157
|
interval = nack_backoff_intervals[nack_retry]
|
158
158
|
nack_retry += 1
|
159
|
-
raise ::Protobuf::Nats::Errors::RequestTimeout if interval.nil?
|
159
|
+
raise ::Protobuf::Nats::Errors::RequestTimeout, formatted_service_and_method_name if interval.nil?
|
160
160
|
sleep((interval + nack_backoff_splay)/1000.0)
|
161
161
|
next
|
162
162
|
end
|
@@ -186,6 +186,12 @@ module Protobuf
|
|
186
186
|
end
|
187
187
|
end
|
188
188
|
|
189
|
+
def formatted_service_and_method_name
|
190
|
+
klass = @options[:service]
|
191
|
+
method_name = @options[:method]
|
192
|
+
"#{klass}##{method_name}"
|
193
|
+
end
|
194
|
+
|
189
195
|
# The Java nats client offers better message queueing so we're going to use
|
190
196
|
# that over locking ourselves. This split in code isn't great, but we can
|
191
197
|
# refactor this later.
|
@@ -231,7 +237,7 @@ module Protobuf
|
|
231
237
|
else return :ack_timeout
|
232
238
|
end
|
233
239
|
|
234
|
-
fail(::Protobuf::Nats::Errors::ResponseTimeout,
|
240
|
+
fail(::Protobuf::Nats::Errors::ResponseTimeout, formatted_service_and_method_name) unless response
|
235
241
|
|
236
242
|
completed_request = true
|
237
243
|
response
|
@@ -287,7 +293,7 @@ module Protobuf
|
|
287
293
|
else return :ack_timeout
|
288
294
|
end
|
289
295
|
|
290
|
-
fail(::Protobuf::Nats::Errors::ResponseTimeout,
|
296
|
+
fail(::Protobuf::Nats::Errors::ResponseTimeout, formatted_service_and_method_name) unless response
|
291
297
|
|
292
298
|
response
|
293
299
|
ensure
|
data/lib/protobuf/nats/config.rb
CHANGED
@@ -40,7 +40,12 @@ module Protobuf
|
|
40
40
|
config_path = ENV["PROTOBUF_NATS_CONFIG_PATH"] || ::File.join("config", "protobuf_nats.yml")
|
41
41
|
absolute_config_path = ::File.expand_path(config_path)
|
42
42
|
if ::File.exists?(absolute_config_path)
|
43
|
-
|
43
|
+
# Psych 4 and newer requires unsafe_load_file in order for aliases to be used
|
44
|
+
yaml_config = if ::YAML.respond_to?(:unsafe_load_file)
|
45
|
+
::YAML.unsafe_load_file(absolute_config_path)[env]
|
46
|
+
else
|
47
|
+
::YAML.load_file(absolute_config_path)[env]
|
48
|
+
end
|
44
49
|
end
|
45
50
|
|
46
51
|
DEFAULTS.each_pair do |key, value|
|
data/lib/protobuf/nats/errors.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
module Protobuf
|
2
2
|
module Nats
|
3
3
|
module Errors
|
4
|
-
class
|
4
|
+
class ClientError < ::StandardError
|
5
5
|
end
|
6
6
|
|
7
|
-
class RequestTimeout <
|
7
|
+
class RequestTimeout < ClientError
|
8
8
|
end
|
9
9
|
|
10
|
-
class ResponseTimeout <
|
10
|
+
class ResponseTimeout < ClientError
|
11
11
|
end
|
12
12
|
|
13
13
|
class MriIOException < ::StandardError
|
data/lib/protobuf/nats/jnats.rb
CHANGED
@@ -5,11 +5,6 @@ require ::File.join(ext_base, "jars/slf4j-simple-1.7.25.jar")
|
|
5
5
|
require ::File.join(ext_base, "jars/gson-2.6.2.jar")
|
6
6
|
require ::File.join(ext_base, "jars/jnats-1.1-SNAPSHOT.jar")
|
7
7
|
|
8
|
-
# Set field accessors so we can access the member variables directly.
|
9
|
-
class Java::IoNatsClient::SubscriptionImpl
|
10
|
-
field_accessor :pMsgs, :pBytes, :delivered
|
11
|
-
end
|
12
|
-
|
13
8
|
module Protobuf
|
14
9
|
module Nats
|
15
10
|
class JNats
|
@@ -190,9 +185,9 @@ module Protobuf
|
|
190
185
|
# We have to update the subscription stats so we're not considered a slow consumer.
|
191
186
|
begin
|
192
187
|
sub.lock
|
193
|
-
sub.
|
194
|
-
sub.
|
195
|
-
sub.
|
188
|
+
sub.incrPMsgs(-1)
|
189
|
+
sub.incrPBytes(-message.getData.length) if message.getData
|
190
|
+
sub.incrDelivered(1) unless sub.isClosed
|
196
191
|
ensure
|
197
192
|
sub.unlock
|
198
193
|
end
|
data/protobuf-nats.gemspec
CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |spec|
|
|
11
11
|
|
12
12
|
spec.summary = %q{ ruby-protobuf client/server for nats }
|
13
13
|
spec.description = %q{ ruby-protobuf client/server for nats }
|
14
|
-
|
14
|
+
spec.homepage = "https://github.com/mxenabled/protobuf-nats"
|
15
15
|
spec.license = "MIT"
|
16
16
|
|
17
17
|
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
|
|
35
35
|
spec.add_runtime_dependency "protobuf", "~> 3.7", ">= 3.7.2"
|
36
36
|
spec.add_runtime_dependency "nats-pure", "~> 0.3", "< 0.4"
|
37
37
|
|
38
|
-
spec.add_development_dependency "bundler"
|
38
|
+
spec.add_development_dependency "bundler"
|
39
39
|
spec.add_development_dependency "rake", "~> 10.0"
|
40
40
|
spec.add_development_dependency "rspec"
|
41
41
|
spec.add_development_dependency "benchmark-ips"
|
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/bin/bash
|
2
|
+
|
3
|
+
set -e
|
4
|
+
|
5
|
+
export DEFAULT_NATS_SERVER_VERSION=v2.0.0
|
6
|
+
|
7
|
+
export NATS_SERVER_VERSION="${NATS_SERVER_VERSION:=$DEFAULT_NATS_SERVER_VERSION}"
|
8
|
+
|
9
|
+
# check to see if nats-server folder is empty
|
10
|
+
if [ ! "$(ls -A $HOME/nats-server)" ]; then
|
11
|
+
(
|
12
|
+
mkdir -p $HOME/nats-server
|
13
|
+
cd $HOME/nats-server
|
14
|
+
wget https://github.com/nats-io/nats-server/releases/download/$NATS_SERVER_VERSION/nats-server-$NATS_SERVER_VERSION-linux-amd64.zip -O nats-server.zip
|
15
|
+
unzip nats-server.zip
|
16
|
+
cp nats-server-$NATS_SERVER_VERSION-linux-amd64/nats-server $HOME/nats-server/nats-server
|
17
|
+
)
|
18
|
+
else
|
19
|
+
echo 'Using cached directory.';
|
20
|
+
fi
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: protobuf-nats
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brandon Dewitt
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-02-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -82,16 +82,16 @@ dependencies:
|
|
82
82
|
name: bundler
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- - "
|
85
|
+
- - ">="
|
86
86
|
- !ruby/object:Gem::Version
|
87
|
-
version: '
|
87
|
+
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
90
|
version_requirements: !ruby/object:Gem::Requirement
|
91
91
|
requirements:
|
92
|
-
- - "
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: '
|
94
|
+
version: '0'
|
95
95
|
- !ruby/object:Gem::Dependency
|
96
96
|
name: rake
|
97
97
|
requirement: !ruby/object:Gem::Requirement
|
@@ -184,12 +184,13 @@ files:
|
|
184
184
|
- lib/protobuf/nats/thread_pool.rb
|
185
185
|
- lib/protobuf/nats/version.rb
|
186
186
|
- protobuf-nats.gemspec
|
187
|
-
|
187
|
+
- scripts/install_gnatsd.sh
|
188
|
+
homepage: https://github.com/mxenabled/protobuf-nats
|
188
189
|
licenses:
|
189
190
|
- MIT
|
190
191
|
metadata:
|
191
192
|
allowed_push_host: https://rubygems.org
|
192
|
-
post_install_message:
|
193
|
+
post_install_message:
|
193
194
|
rdoc_options: []
|
194
195
|
require_paths:
|
195
196
|
- lib
|
@@ -204,9 +205,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
204
205
|
- !ruby/object:Gem::Version
|
205
206
|
version: '0'
|
206
207
|
requirements: []
|
207
|
-
|
208
|
-
|
209
|
-
signing_key:
|
208
|
+
rubygems_version: 3.2.28
|
209
|
+
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: ruby-protobuf client/server for nats
|
212
212
|
test_files: []
|