sneakers_packer 0.1.2 → 0.1.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1081bb8dfd081ab0d491a6311e32622ab652f4a5
4
- data.tar.gz: 6cbb03f07b1a08b15e79da3b89a4a9d786400deb
3
+ metadata.gz: ff389357c884d101bf40e88ca9aefe4bde8b3456
4
+ data.tar.gz: 7a8798e701af7d03af51bd8642f60490c4725706
5
5
  SHA512:
6
- metadata.gz: 92290957fdc718b1ce4713ce73c228e0a760baa71c5ba81a121e7e5c4f4f132d5565f53fd52b752e4ca7be6e91dcdc98bd9948de1e96384dde59be949c6ba05b
7
- data.tar.gz: 93c3d7b442b35e6d589cb1679fad6f6962e2dd0cbb4e8dcb046216633e01e31073935e7a934b0e9768eecfc951892c5ee2ea63cab9df448548627fbc8472a06b
6
+ metadata.gz: 2405dd49c34a9d5ac164898c9e0acc21678550144b951f2ddab440e628741b76f2bd623d3bb2be7037897b66313fb53de7effc790d099616e17412fe027b644c
7
+ data.tar.gz: 039f97e4b51ff74623cab87a951e184edf9e7c22540ae252aa9766901f408c8cf22c95fc82db47706ab3998d457cfaa50c3919a74d1e2dcd0171e5ae08349087
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.1.3
2
+
3
+ * [Bugfix] Change RemoteCallTimeoutError's parent to StandardError.
4
+ * [Bugfix] Define NO_RESPONSE for rpc client.
1
5
 
2
6
  ## 0.1.2
3
7
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # SneakersPacker
2
2
 
3
- SneakersPacker is a gem for using sneakers to 3 message communication patterns job message, broadcast and RPC(remote procedure call).
3
+ SneakersPacker is a gem for using sneakers to realize 3 message communication patterns job message, broadcast and RPC(remote procedure call).
4
4
 
5
5
  ## Installation
6
6
 
@@ -121,6 +121,7 @@ remote call with custom timeouit.
121
121
  ```
122
122
 
123
123
  **See the gem doc or source code for accurate detail**
124
+ **You can see the demo app for SneakersPacker by** [Sneakers](https://github.com/xiewenwei/sneakers_demo).
124
125
 
125
126
  ## Development
126
127
 
@@ -11,6 +11,8 @@ module SneakersPacker
11
11
  @consumer = build_reply_queue(channel, exchange)
12
12
  end
13
13
 
14
+ NO_RESPONSE = :__no_resp
15
+
14
16
  # call remote service via rabbitmq rpc
15
17
  # @param name route_key for service
16
18
  # @param message
@@ -19,7 +21,7 @@ module SneakersPacker
19
21
  # @raise RemoteCallTimeoutError if timeout
20
22
  def call(name, message, options = {})
21
23
  self.call_id = SecureRandom.uuid
22
- self.response = nil
24
+ self.response = NO_RESPONSE
23
25
 
24
26
  ensure_reply_queue!
25
27
 
@@ -32,10 +34,10 @@ module SneakersPacker
32
34
 
33
35
  lock.synchronize { condition.wait(lock, timeout) }
34
36
 
35
- if response
36
- response
37
+ if response == NO_RESPONSE
38
+ raise RemoteCallTimeoutError, "remote call timeout. exceed #{timeout} seconds."
37
39
  else
38
- raise RemoteCallTimeoutError.new("远程调用超时")
40
+ response
39
41
  end
40
42
  end
41
43
 
@@ -1,3 +1,3 @@
1
1
  module SneakersPacker
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -7,7 +7,7 @@ require "sneakers_packer/rpc_worker"
7
7
  require "sneakers_packer/rpc_client"
8
8
 
9
9
  module SneakersPacker
10
- class RemoteCallTimeoutError < Exception; end
10
+ class RemoteCallTimeoutError < StandardError; end
11
11
 
12
12
  # sender message to sneaker exchange
13
13
  # @param name route_key for message
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sneakers_packer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - vincent
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-18 00:00:00.000000000 Z
11
+ date: 2016-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sneakers