stomp_actors 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/stomp_actors/consumer.rb +1 -1
- data/lib/stomp_actors/version.rb +1 -1
- data/spec/spec_helper.rb +2 -0
- data/spec/stomp_actors/client_spec.rb +11 -15
- data/spec/stomp_actors/consumer_spec.rb +24 -27
- data/spec/stomp_actors/producer_spec.rb +9 -12
- metadata +2 -2
data/lib/stomp_actors/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -1,25 +1,21 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
class MyActor
|
4
|
+
include Celluloid
|
5
|
+
include StompActors::Client
|
6
|
+
|
7
|
+
def connect_opts
|
8
|
+
{
|
9
|
+
hosts: [{ host: '127.0.0.1', port: 61623 }]
|
10
|
+
}
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
3
14
|
describe StompActors::Client do
|
4
15
|
let(:host) { '127.0.0.1' }
|
5
16
|
let(:port) { 61623 }
|
6
17
|
|
7
18
|
before do
|
8
|
-
|
9
|
-
class MyActor
|
10
|
-
include Celluloid
|
11
|
-
include StompActors::Client
|
12
|
-
|
13
|
-
def connect_opts
|
14
|
-
{
|
15
|
-
hosts: [{ host: '127.0.0.1', port: 61623 }]
|
16
|
-
}
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
Celluloid.shutdown
|
21
|
-
Celluloid.boot
|
22
|
-
|
23
19
|
@server_thread = StompDroid::Server.start(host, port)
|
24
20
|
sleep 0.1 # let start
|
25
21
|
end
|
@@ -1,5 +1,29 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
class MyConsumer < StompActors::Consumer
|
4
|
+
attr_reader :queue
|
5
|
+
|
6
|
+
def initialize(host, port, queue)
|
7
|
+
@host = host
|
8
|
+
@port = port
|
9
|
+
@queue = queue
|
10
|
+
super()
|
11
|
+
end
|
12
|
+
|
13
|
+
def connect_opts
|
14
|
+
{
|
15
|
+
hosts: [{ host: @host, port: @port}]
|
16
|
+
}
|
17
|
+
end
|
18
|
+
|
19
|
+
def receive(msg)
|
20
|
+
do_something
|
21
|
+
ack(msg)
|
22
|
+
end
|
23
|
+
|
24
|
+
def do_something; end
|
25
|
+
end
|
26
|
+
|
3
27
|
describe StompActors::Consumer do
|
4
28
|
let(:host) { '127.0.0.1' }
|
5
29
|
let(:port) { 61623 }
|
@@ -7,33 +31,6 @@ describe StompActors::Consumer do
|
|
7
31
|
let(:msg) { "something" }
|
8
32
|
|
9
33
|
before do
|
10
|
-
class MyConsumer < StompActors::Consumer
|
11
|
-
attr_reader :queue
|
12
|
-
|
13
|
-
def initialize(host, port, queue)
|
14
|
-
@host = host
|
15
|
-
@port = port
|
16
|
-
@queue = queue
|
17
|
-
super()
|
18
|
-
end
|
19
|
-
|
20
|
-
def connect_opts
|
21
|
-
{
|
22
|
-
hosts: [{ host: @host, port: @port}]
|
23
|
-
}
|
24
|
-
end
|
25
|
-
|
26
|
-
def receive(msg)
|
27
|
-
do_something
|
28
|
-
ack(msg)
|
29
|
-
end
|
30
|
-
|
31
|
-
def do_something; end
|
32
|
-
end
|
33
|
-
|
34
|
-
Celluloid.shutdown
|
35
|
-
Celluloid.boot
|
36
|
-
|
37
34
|
@server_thread = StompDroid::Server.start(host, port, queue_name: queue, message: msg)
|
38
35
|
sleep 0.1 # let start
|
39
36
|
end
|
@@ -1,5 +1,14 @@
|
|
1
1
|
require 'spec_helper'
|
2
2
|
|
3
|
+
class MyProducer < StompActors::Producer
|
4
|
+
def connect_opts
|
5
|
+
{ hosts: [{ host: "127.0.0.1", port: 61623 }] }
|
6
|
+
end
|
7
|
+
def queue
|
8
|
+
'/queue/foo'
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
3
12
|
describe StompActors::Producer do
|
4
13
|
let(:host) { '127.0.0.1' }
|
5
14
|
let(:port) { 61623 }
|
@@ -7,18 +16,6 @@ describe StompActors::Producer do
|
|
7
16
|
let(:message_dir) { 'tmp/messages' }
|
8
17
|
|
9
18
|
before do
|
10
|
-
class MyProducer < StompActors::Producer
|
11
|
-
def connect_opts
|
12
|
-
{ hosts: [{ host: "127.0.0.1", port: 61623 }] }
|
13
|
-
end
|
14
|
-
def queue
|
15
|
-
'/queue/foo'
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
Celluloid.shutdown
|
20
|
-
Celluloid.boot
|
21
|
-
|
22
19
|
@server_thread = StompDroid::Server.start(host, port, queue_name: queue, sent_message_dir: message_dir)
|
23
20
|
sleep 0.1 # let start
|
24
21
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stomp_actors
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-07-01 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|