sub_zero 0.0.3 → 0.0.4
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/lib/sub_zero/client/socket.rb +12 -6
- data/lib/sub_zero/client.rb +2 -1
- data/lib/sub_zero/version.rb +1 -1
- data/lib/sub_zero.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d2f91d35235df49176ba39a8f3cd6bf5cbca454
|
4
|
+
data.tar.gz: ada80f112ceff71a231d9bf2b05c05ce30cb66a2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 496a8f67eb47c3105724e05cab034f5efd519c120f7d6807de1173b2015c57692a622d6f25204fa11446be2a5fb84276d9c58dbe2727929108d79f85bcc11ac1
|
7
|
+
data.tar.gz: 5d0dc86764da65b7eacff51daa6431fd091a7a2055864bc8c84377bf8f15488df15ebc569c382ea2505e1cdfb6103ccc33929fbfb43ff962b329d9d64bf25174
|
@@ -12,15 +12,21 @@ module SubZero
|
|
12
12
|
def zeromq_fetch verb, payload = {}, options = {}
|
13
13
|
result = []
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
timeout = options.fetch(:timeout, 1000) / 1000.0
|
16
|
+
|
17
|
+
Timeout.timeout timeout do
|
18
|
+
zeromq_context do |context|
|
19
|
+
zeromq_socket context do |socket|
|
20
|
+
rid = SecureRandom.uuid
|
21
|
+
zeromq_send socket, "REQ:#{sid}", rid, verb, payload.to_msgpack, options.to_msgpack
|
22
|
+
result = zeromq_result(socket, rid, verb)
|
23
|
+
end
|
20
24
|
end
|
21
25
|
end
|
22
26
|
|
23
27
|
result
|
28
|
+
rescue Timeout::Error
|
29
|
+
raise SubZero::Client::Error.new(code: 'timeout', message: "call timeout: #{timeout}s")
|
24
30
|
end
|
25
31
|
|
26
32
|
def zeromq_context
|
@@ -62,7 +68,7 @@ module SubZero
|
|
62
68
|
zeromq_validate_result! rid, verb, result
|
63
69
|
|
64
70
|
routing_info = MessagePack.unpack(result.pop)
|
65
|
-
payload
|
71
|
+
payload = MessagePack.unpack(result.pop)
|
66
72
|
rep_verb = result.pop
|
67
73
|
status = rep_verb.end_with?('NOK') ? :error : :ok
|
68
74
|
|
data/lib/sub_zero/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'active_support/string_inquirer'
|
2
|
+
require 'active_support/hash_with_indifferent_access'
|
2
3
|
|
3
4
|
module SubZero
|
4
5
|
class Client
|
@@ -17,7 +18,7 @@ module SubZero
|
|
17
18
|
def call verb, payload = {}, options = {}
|
18
19
|
sz_verb = verb.to_s.upcase.gsub('_', '/')
|
19
20
|
status, result = zeromq_fetch(sz_verb, payload, options)
|
20
|
-
result = handle_result(status, result)
|
21
|
+
result = handle_result(status, result).with_indifferent_access
|
21
22
|
block_given? ? yield(result) : result
|
22
23
|
end
|
23
24
|
|
data/lib/sub_zero/version.rb
CHANGED
data/lib/sub_zero.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sub_zero
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Rodrigues
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-08-
|
12
|
+
date: 2013-08-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -176,7 +176,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
176
176
|
version: '0'
|
177
177
|
requirements: []
|
178
178
|
rubyforge_project:
|
179
|
-
rubygems_version: 2.0.
|
179
|
+
rubygems_version: 2.0.3
|
180
180
|
signing_key:
|
181
181
|
specification_version: 4
|
182
182
|
summary: ZeroMQ GREAT SOA solution
|