villein 0.3.0 → 0.3.1

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
  SHA1:
3
- metadata.gz: 5d9b9e6c34204126822c64c925e9a83ef3120b29
4
- data.tar.gz: 548c1b7932f71f81db8df8fb23f70a9a3ae10879
3
+ metadata.gz: 5504579a7f36a554a5b9b4097b1a989e6dfec869
4
+ data.tar.gz: 0cbdf8a76aaf7b70139a038137819e43f4321a51
5
5
  SHA512:
6
- metadata.gz: 84d91183e28e93240f478ea4ecaeebaafdbe027c3c7506fb77f8bab97ce7fc1a1c4f4b4c45f3f8298992ea6310668d525cfc4054dc2fe0bef161316a33dee9da
7
- data.tar.gz: f3632f50eded1238d24d645228871ff6edd3b99f2f637f0534bd0633d5bc6e147d18321ffc0f8348aaae2f62af6fac596d672697f3508ff4469781fa973937b6
6
+ metadata.gz: 9410e54f2bf7c519d186f3189696ffe32940aae6ad3cea9e92d73a50c93c2a981f086a41f014ac05e8e20f66b9f72b76f2511cd6be8e92f4f9360c99d17c80d4
7
+ data.tar.gz: c755c0fdbd9c297a018a3ed004d73e2e13320022bb5bdf982ccea89862eaa00257df83dfc1d5e364065ec59759bf57b1573fe423eb9fd6ff2dbffd7eb976c8c0
data/README.md CHANGED
@@ -19,6 +19,8 @@ Or install it yourself as:
19
19
  ## Requirements
20
20
 
21
21
  - Ruby 2.0.0+
22
+ - Serf
23
+ - v0.6.0 or later is required to use `query` and `info` method
22
24
 
23
25
  ## Usage
24
26
 
@@ -71,6 +73,12 @@ client.event('my-event', 'payload')
71
73
  client.event('my-event', 'payload', coalesce: true)
72
74
  ```
73
75
 
76
+ ### Querying
77
+
78
+ ``` ruby
79
+ client.query('hey', '') #=> {"Acks"=>["XXX.local"], "Responses"=>{"XXX"=>"..."}}
80
+ ```
81
+
74
82
  ### Retrieve member list
75
83
 
76
84
  ``` ruby
@@ -128,6 +136,24 @@ agent.on_event { |status|
128
136
  }
129
137
  ```
130
138
 
139
+ ### (Agent only) Respond to query events
140
+
141
+ ``` ruby
142
+ agent = Villein::Agent.new
143
+ agent.start!
144
+
145
+ agent.respond("hey") { "hello" }
146
+ ```
147
+
148
+ ```
149
+ $ serf query hey
150
+ Query 'hey' dispatched
151
+ Ack from 'XXX.local'
152
+ Response from 'XXX.local': hello
153
+ Total Acks: 1
154
+ Total Responses: 1
155
+ ```
156
+
131
157
  ## Advanced
132
158
 
133
159
  TBD
data/lib/villein/agent.rb CHANGED
@@ -275,6 +275,7 @@ module Villein
275
275
  # do nothing
276
276
  rescue Exception => e
277
277
  $stderr.puts "Exception during handling event: #{event.inspect}"
278
+ $stderr.puts "#{e.class}: #{e.message}"
278
279
  $stderr.puts e.backtrace.map { |_| _.prepend("\t") }
279
280
  end
280
281
 
@@ -1,3 +1,3 @@
1
1
  module Villein
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: villein
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shota Fukumori (sora_h)
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-12 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec