dripdrop 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/dripdrop.gemspec +2 -2
- data/lib/dripdrop/handlers/zeromq.rb +3 -2
- data/spec/node/zmq_xrepxreq_spec.rb +19 -5
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.1
|
data/dripdrop.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{dripdrop}
|
8
|
-
s.version = "0.4.
|
8
|
+
s.version = "0.4.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Andrew Cholakian"]
|
12
|
-
s.date = %q{2010-11-
|
12
|
+
s.date = %q{2010-11-16}
|
13
13
|
s.description = %q{Evented framework for ZeroMQ and EventMachine Apps. }
|
14
14
|
s.email = %q{andrew@andrewvc.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -198,7 +198,7 @@ class DripDrop
|
|
198
198
|
end
|
199
199
|
end
|
200
200
|
|
201
|
-
class ZMQXRepHandler::Response
|
201
|
+
class ZMQXRepHandler::Response < ZMQBaseHandler
|
202
202
|
attr_accessor :xrep, :seq, :identities
|
203
203
|
|
204
204
|
def initialize(xrep,identities,seq)
|
@@ -208,7 +208,8 @@ class DripDrop
|
|
208
208
|
end
|
209
209
|
|
210
210
|
def send_message(message)
|
211
|
-
|
211
|
+
dd_message = dd_messagify(message)
|
212
|
+
@xrep.send_message(dd_message,identities,seq)
|
212
213
|
end
|
213
214
|
end
|
214
215
|
|
@@ -2,7 +2,8 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe "zmq xreq/xrep" do
|
4
4
|
def xr_tranceive_messages(to_send,&block)
|
5
|
-
recvd
|
5
|
+
recvd = []
|
6
|
+
replied = []
|
6
7
|
req = nil
|
7
8
|
rep = nil
|
8
9
|
|
@@ -14,26 +15,39 @@ describe "zmq xreq/xrep" do
|
|
14
15
|
|
15
16
|
rep.on_recv do |message,response|
|
16
17
|
recvd << {:message => message, :response => response}
|
18
|
+
|
19
|
+
response.send_message :name => 'response', :body => {:orig_name => message.name}
|
17
20
|
end
|
18
21
|
|
19
|
-
to_send.each
|
22
|
+
to_send.each do |message|
|
23
|
+
req.send_message(message) do |reply_message|
|
24
|
+
replied << reply_message
|
25
|
+
end
|
26
|
+
end
|
20
27
|
end
|
21
28
|
|
22
|
-
{:recvd => recvd, :handlers => {:req => req, :rep => rep}}
|
29
|
+
{:recvd => recvd, :replied => replied, :handlers => {:req => req, :rep => rep}}
|
23
30
|
end
|
24
31
|
describe "basic sending and receiving" do
|
25
32
|
before(:all) do
|
26
33
|
@sent = []
|
27
34
|
10.times {|i| @sent << DripDrop::Message.new("test-#{i}")}
|
28
35
|
xr_info = xr_tranceive_messages(@sent)
|
29
|
-
@recvd
|
36
|
+
@recvd = xr_info[:recvd]
|
37
|
+
@replied = xr_info[:replied]
|
30
38
|
@req_handler = xr_info[:handlers][:req]
|
31
39
|
@rep_handler = xr_info[:handlers][:rep]
|
32
40
|
end
|
33
41
|
|
34
42
|
it "should receive all sent messages in order" do
|
35
43
|
@sent.zip(@recvd).each do |sent,recvd|
|
36
|
-
|
44
|
+
recvd[:message].name.should == sent.name
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
it "should receive a reply message for each sent message" do
|
49
|
+
@sent.zip(@replied).each do |sent, replied|
|
50
|
+
replied.body[:orig_name].should == sent.name
|
37
51
|
end
|
38
52
|
end
|
39
53
|
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
8
|
+
- 1
|
9
|
+
version: 0.4.1
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Andrew Cholakian
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-11-
|
17
|
+
date: 2010-11-16 00:00:00 -08:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|