cloudist 0.4.3 → 0.4.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.
- data/Gemfile +4 -4
- data/Gemfile.lock +21 -20
- data/README.md +20 -81
- data/VERSION +1 -1
- data/cloudist.gemspec +20 -41
- data/lib/cloudist/queue.rb +36 -33
- data/spec/cloudist/message_spec.rb +89 -89
- data/spec/cloudist/messaging_spec.rb +17 -17
- data/spec/cloudist/payload_spec.rb +28 -29
- data/spec/cloudist/queue_spec.rb +14 -14
- metadata +118 -142
data/Gemfile
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
source :rubygems
|
2
2
|
|
3
|
-
gem 'amqp', '~>0.8.
|
3
|
+
gem 'amqp', '~> 0.8.1'
|
4
4
|
gem "json", "~> 1.4.6"
|
5
5
|
gem "i18n"
|
6
6
|
gem "activesupport", "~> 3.0.3"
|
@@ -10,12 +10,12 @@ gem "uuid"
|
|
10
10
|
# Add dependencies to develop your gem here.
|
11
11
|
# Include everything needed to run rake, tests, features, etc.
|
12
12
|
group :development do
|
13
|
-
gem "rake", "~> 0.
|
14
|
-
gem "rspec", "~> 2.
|
13
|
+
gem "rake", "~> 0.9.2"
|
14
|
+
gem "rspec", "~> 2.4.0"
|
15
15
|
gem "moqueue", :git => "git://github.com/ivanvanderbyl/moqueue.git"
|
16
16
|
gem "mocha"
|
17
17
|
gem "bundler", "~> 1.0.0"
|
18
|
-
gem "jeweler", "~> 1.
|
18
|
+
gem "jeweler", "~> 1.6.4"
|
19
19
|
gem "rcov", ">= 0"
|
20
20
|
gem "reek", "~> 1.2.8"
|
21
21
|
gem "roodi", "~> 2.1.0"
|
data/Gemfile.lock
CHANGED
@@ -9,26 +9,27 @@ GEM
|
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
11
|
activesupport (3.0.7)
|
12
|
-
amq-client (0.
|
13
|
-
amq-protocol
|
12
|
+
amq-client (0.8.5)
|
13
|
+
amq-protocol (>= 0.8.0)
|
14
14
|
eventmachine
|
15
|
-
amq-protocol (0.
|
16
|
-
amqp (0.8.
|
17
|
-
amq-client (
|
15
|
+
amq-protocol (0.8.3)
|
16
|
+
amqp (0.8.2)
|
17
|
+
amq-client (~> 0.8.5)
|
18
|
+
amq-protocol (~> 0.8.3)
|
18
19
|
eventmachine
|
19
|
-
diff-lcs (1.1.
|
20
|
+
diff-lcs (1.1.3)
|
20
21
|
eventmachine (0.12.10)
|
21
22
|
git (1.2.5)
|
22
23
|
hashie (1.0.0)
|
23
24
|
i18n (0.5.0)
|
24
|
-
jeweler (1.
|
25
|
-
bundler (~> 1.0
|
25
|
+
jeweler (1.6.4)
|
26
|
+
bundler (~> 1.0)
|
26
27
|
git (>= 1.2.5)
|
27
28
|
rake
|
28
29
|
json (1.4.6)
|
29
30
|
macaddr (1.0.0)
|
30
31
|
mocha (0.9.12)
|
31
|
-
rake (0.
|
32
|
+
rake (0.9.2.2)
|
32
33
|
rcov (0.9.9)
|
33
34
|
reek (1.2.8)
|
34
35
|
ruby2ruby (~> 1.2)
|
@@ -36,14 +37,14 @@ GEM
|
|
36
37
|
sexp_processor (~> 3.0)
|
37
38
|
roodi (2.1.0)
|
38
39
|
ruby_parser
|
39
|
-
rspec (2.
|
40
|
-
rspec-core (~> 2.
|
41
|
-
rspec-expectations (~> 2.
|
42
|
-
rspec-mocks (~> 2.
|
43
|
-
rspec-core (2.
|
44
|
-
rspec-expectations (2.
|
40
|
+
rspec (2.4.0)
|
41
|
+
rspec-core (~> 2.4.0)
|
42
|
+
rspec-expectations (~> 2.4.0)
|
43
|
+
rspec-mocks (~> 2.4.0)
|
44
|
+
rspec-core (2.4.0)
|
45
|
+
rspec-expectations (2.4.0)
|
45
46
|
diff-lcs (~> 1.1.2)
|
46
|
-
rspec-mocks (2.
|
47
|
+
rspec-mocks (2.4.0)
|
47
48
|
ruby2ruby (1.2.5)
|
48
49
|
ruby_parser (~> 2.0)
|
49
50
|
sexp_processor (~> 3.0)
|
@@ -58,17 +59,17 @@ PLATFORMS
|
|
58
59
|
|
59
60
|
DEPENDENCIES
|
60
61
|
activesupport (~> 3.0.3)
|
61
|
-
amqp (~> 0.8.
|
62
|
+
amqp (~> 0.8.1)
|
62
63
|
bundler (~> 1.0.0)
|
63
64
|
hashie
|
64
65
|
i18n
|
65
|
-
jeweler (~> 1.
|
66
|
+
jeweler (~> 1.6.4)
|
66
67
|
json (~> 1.4.6)
|
67
68
|
mocha
|
68
69
|
moqueue!
|
69
|
-
rake (~> 0.
|
70
|
+
rake (~> 0.9.2)
|
70
71
|
rcov
|
71
72
|
reek (~> 1.2.8)
|
72
73
|
roodi (~> 2.1.0)
|
73
|
-
rspec (~> 2.
|
74
|
+
rspec (~> 2.4.0)
|
74
75
|
uuid
|
data/README.md
CHANGED
@@ -11,88 +11,20 @@ or even just sending emails. Unlike other job queues (DelayedJob etc) Cloudist d
|
|
11
11
|
Installation
|
12
12
|
------------
|
13
13
|
|
14
|
-
|
14
|
+
```bash
|
15
|
+
gem install cloudist
|
16
|
+
```
|
15
17
|
|
16
18
|
Or if your app has a Gemfile:
|
17
|
-
|
18
|
-
|
19
|
+
|
20
|
+
```ruby
|
21
|
+
gem 'cloudist', '~> 0.4.4'
|
22
|
+
```
|
19
23
|
|
20
24
|
Usage
|
21
25
|
-----
|
22
26
|
|
23
|
-
|
24
|
-
|
25
|
-
Cloudist.start {
|
26
|
-
# usual stuff here
|
27
|
-
job('make.sandwich') {
|
28
|
-
# define a job handler
|
29
|
-
}
|
30
|
-
}
|
31
|
-
|
32
|
-
This will start an AMQP connection and EM loop then yield everything inside it.
|
33
|
-
|
34
|
-
In your worker:
|
35
|
-
|
36
|
-
Cloudist.start {
|
37
|
-
log.info("Started Worker")
|
38
|
-
|
39
|
-
job('make.sandwich') {
|
40
|
-
log.info("JOB (#{id}) Make sandwich with #{data[:bread]} bread")
|
41
|
-
|
42
|
-
job.started!
|
43
|
-
|
44
|
-
(1..20).each do |i|
|
45
|
-
job.progress(i * 5)
|
46
|
-
sleep(1)
|
47
|
-
end
|
48
|
-
job.finished!
|
49
|
-
}
|
50
|
-
|
51
|
-
}
|
52
|
-
|
53
|
-
In your application:
|
54
|
-
|
55
|
-
Cloudist.start {
|
56
|
-
|
57
|
-
log.info("Dispatching sandwich making job...")
|
58
|
-
|
59
|
-
Cloudist.enqueue('make.sandwich', {:bread => 'white', :sandwich_number => 1})
|
60
|
-
|
61
|
-
# Listen to all sandwich jobs
|
62
|
-
listen('make.sandwich') {
|
63
|
-
everything {
|
64
|
-
Cloudist.log.info("#{headers[:message_type]} - Job ID: #{job_id}")
|
65
|
-
}
|
66
|
-
|
67
|
-
# This will contain any exceptions which are raised while processing the job, which will halt the job
|
68
|
-
error { |e|
|
69
|
-
Cloudist.log.error(e.inspect)
|
70
|
-
Cloudist.log.error(e.backtrace.inspect)
|
71
|
-
|
72
|
-
# Exit on failure
|
73
|
-
Cloudist.stop
|
74
|
-
}
|
75
|
-
|
76
|
-
# Process progress updates
|
77
|
-
progress {
|
78
|
-
Cloudist.log.info("Progress: #{data[:progress]}")
|
79
|
-
}
|
80
|
-
|
81
|
-
event('started') {
|
82
|
-
Cloudist.log.info("Started making sandwich at #{Time.now.to_s}")
|
83
|
-
}
|
84
|
-
|
85
|
-
event('finished'){
|
86
|
-
Cloudist.log.info("Finished making sandwich at #{Time.now.to_s}")
|
87
|
-
# Exit when done
|
88
|
-
Cloudist.stop
|
89
|
-
}
|
90
|
-
}
|
91
|
-
|
92
|
-
}
|
93
|
-
|
94
|
-
|
95
|
-
If your application provides an AMQP.start loop already, you can skip the Cloudist.start
|
27
|
+
**Refer to examples.**
|
96
28
|
|
97
29
|
Configuration
|
98
30
|
-------------
|
@@ -102,10 +34,17 @@ The only configuration required to get going are the AMQP settings, these can be
|
|
102
34
|
1. Using the `AMQP_URL` environment variable with value of `amqp://username:password@localhost:5672/vhost`
|
103
35
|
|
104
36
|
2. Updating the settings hash manually:
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
37
|
+
|
38
|
+
```ruby
|
39
|
+
Cloudist.settings = {:user => 'guest', :pass => 'password', :vhost => '/', :host => 'localhost', :port => 5672}
|
40
|
+
```
|
41
|
+
|
42
|
+
Now and what's coming
|
43
|
+
---------------------
|
44
|
+
|
45
|
+
Cloudist was developed to provide the messaging layer used within TestPilot [Continuous Integration](http://testpilot.me) service.
|
46
|
+
|
47
|
+
TestPilot still uses [Cloudist](http://testpilot.me/ivan/cloudist) heavily and a number of features will be merged in soon.
|
109
48
|
|
110
49
|
Acknowledgements
|
111
50
|
----------------
|
@@ -130,7 +69,7 @@ Contributing to Cloudist
|
|
130
69
|
Authors
|
131
70
|
-------
|
132
71
|
|
133
|
-
|
72
|
+
[IvanVanderbyl](http://testpilot.me/ivan) - [Blog](http://ivanvanderbyl.github.com/)
|
134
73
|
|
135
74
|
Copyright
|
136
75
|
---------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.4.
|
1
|
+
0.4.4
|
data/cloudist.gemspec
CHANGED
@@ -4,14 +4,14 @@
|
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
|
-
s.name =
|
8
|
-
s.version = "0.4.
|
7
|
+
s.name = "cloudist"
|
8
|
+
s.version = "0.4.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ivan Vanderbyl"]
|
12
|
-
s.date =
|
13
|
-
s.description =
|
14
|
-
s.email =
|
12
|
+
s.date = "2011-11-08"
|
13
|
+
s.description = "Cloudist is a simple, highly scalable job queue for Ruby applications, it can run within Rails, DaemonKit or your own custom application. Refer to github page for examples"
|
14
|
+
s.email = "ivanvanderbyl@me.com"
|
15
15
|
s.extra_rdoc_files = [
|
16
16
|
"LICENSE.txt",
|
17
17
|
"README.md"
|
@@ -75,82 +75,61 @@ Gem::Specification.new do |s|
|
|
75
75
|
"spec/spec_helper.rb",
|
76
76
|
"spec/support/amqp.rb"
|
77
77
|
]
|
78
|
-
s.homepage =
|
78
|
+
s.homepage = "http://github.com/ivanvanderbyl/cloudist"
|
79
79
|
s.licenses = ["MIT"]
|
80
80
|
s.require_paths = ["lib"]
|
81
|
-
s.rubygems_version =
|
82
|
-
s.summary =
|
83
|
-
s.test_files = [
|
84
|
-
"examples/amqp/amqp_consumer.rb",
|
85
|
-
"examples/amqp/amqp_publisher.rb",
|
86
|
-
"examples/queue_message.rb",
|
87
|
-
"examples/sandwich_client_with_custom_listener.rb",
|
88
|
-
"examples/sandwich_worker.rb",
|
89
|
-
"examples/sandwich_worker_with_class.rb",
|
90
|
-
"spec/cloudist/basic_queue_spec.rb",
|
91
|
-
"spec/cloudist/job_spec.rb",
|
92
|
-
"spec/cloudist/message_spec.rb",
|
93
|
-
"spec/cloudist/messaging_spec.rb",
|
94
|
-
"spec/cloudist/payload_spec.rb",
|
95
|
-
"spec/cloudist/payload_spec_2_spec.rb",
|
96
|
-
"spec/cloudist/queue_spec.rb",
|
97
|
-
"spec/cloudist/request_spec.rb",
|
98
|
-
"spec/cloudist/utils_spec.rb",
|
99
|
-
"spec/cloudist_spec.rb",
|
100
|
-
"spec/core_ext/string_spec.rb",
|
101
|
-
"spec/spec_helper.rb",
|
102
|
-
"spec/support/amqp.rb"
|
103
|
-
]
|
81
|
+
s.rubygems_version = "1.8.10"
|
82
|
+
s.summary = "Super fast job queue using AMQP"
|
104
83
|
|
105
84
|
if s.respond_to? :specification_version then
|
106
85
|
s.specification_version = 3
|
107
86
|
|
108
87
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
109
|
-
s.add_runtime_dependency(%q<amqp>, ["~> 0.8.
|
88
|
+
s.add_runtime_dependency(%q<amqp>, ["~> 0.8.1"])
|
110
89
|
s.add_runtime_dependency(%q<json>, ["~> 1.4.6"])
|
111
90
|
s.add_runtime_dependency(%q<i18n>, [">= 0"])
|
112
91
|
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0.3"])
|
113
92
|
s.add_runtime_dependency(%q<hashie>, [">= 0"])
|
114
93
|
s.add_runtime_dependency(%q<uuid>, [">= 0"])
|
115
|
-
s.add_development_dependency(%q<rake>, ["~> 0.
|
116
|
-
s.add_development_dependency(%q<rspec>, ["~> 2.
|
94
|
+
s.add_development_dependency(%q<rake>, ["~> 0.9.2"])
|
95
|
+
s.add_development_dependency(%q<rspec>, ["~> 2.4.0"])
|
117
96
|
s.add_development_dependency(%q<moqueue>, [">= 0"])
|
118
97
|
s.add_development_dependency(%q<mocha>, [">= 0"])
|
119
98
|
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
120
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.
|
99
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.6.4"])
|
121
100
|
s.add_development_dependency(%q<rcov>, [">= 0"])
|
122
101
|
s.add_development_dependency(%q<reek>, ["~> 1.2.8"])
|
123
102
|
s.add_development_dependency(%q<roodi>, ["~> 2.1.0"])
|
124
103
|
else
|
125
|
-
s.add_dependency(%q<amqp>, ["~> 0.8.
|
104
|
+
s.add_dependency(%q<amqp>, ["~> 0.8.1"])
|
126
105
|
s.add_dependency(%q<json>, ["~> 1.4.6"])
|
127
106
|
s.add_dependency(%q<i18n>, [">= 0"])
|
128
107
|
s.add_dependency(%q<activesupport>, ["~> 3.0.3"])
|
129
108
|
s.add_dependency(%q<hashie>, [">= 0"])
|
130
109
|
s.add_dependency(%q<uuid>, [">= 0"])
|
131
|
-
s.add_dependency(%q<rake>, ["~> 0.
|
132
|
-
s.add_dependency(%q<rspec>, ["~> 2.
|
110
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
111
|
+
s.add_dependency(%q<rspec>, ["~> 2.4.0"])
|
133
112
|
s.add_dependency(%q<moqueue>, [">= 0"])
|
134
113
|
s.add_dependency(%q<mocha>, [">= 0"])
|
135
114
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
136
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
115
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
137
116
|
s.add_dependency(%q<rcov>, [">= 0"])
|
138
117
|
s.add_dependency(%q<reek>, ["~> 1.2.8"])
|
139
118
|
s.add_dependency(%q<roodi>, ["~> 2.1.0"])
|
140
119
|
end
|
141
120
|
else
|
142
|
-
s.add_dependency(%q<amqp>, ["~> 0.8.
|
121
|
+
s.add_dependency(%q<amqp>, ["~> 0.8.1"])
|
143
122
|
s.add_dependency(%q<json>, ["~> 1.4.6"])
|
144
123
|
s.add_dependency(%q<i18n>, [">= 0"])
|
145
124
|
s.add_dependency(%q<activesupport>, ["~> 3.0.3"])
|
146
125
|
s.add_dependency(%q<hashie>, [">= 0"])
|
147
126
|
s.add_dependency(%q<uuid>, [">= 0"])
|
148
|
-
s.add_dependency(%q<rake>, ["~> 0.
|
149
|
-
s.add_dependency(%q<rspec>, ["~> 2.
|
127
|
+
s.add_dependency(%q<rake>, ["~> 0.9.2"])
|
128
|
+
s.add_dependency(%q<rspec>, ["~> 2.4.0"])
|
150
129
|
s.add_dependency(%q<moqueue>, [">= 0"])
|
151
130
|
s.add_dependency(%q<mocha>, [">= 0"])
|
152
131
|
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
153
|
-
s.add_dependency(%q<jeweler>, ["~> 1.
|
132
|
+
s.add_dependency(%q<jeweler>, ["~> 1.6.4"])
|
154
133
|
s.add_dependency(%q<rcov>, [">= 0"])
|
155
134
|
s.add_dependency(%q<reek>, ["~> 1.2.8"])
|
156
135
|
s.add_dependency(%q<roodi>, ["~> 2.1.0"])
|
data/lib/cloudist/queue.rb
CHANGED
@@ -1,35 +1,38 @@
|
|
1
1
|
module Cloudist
|
2
|
+
#
|
3
|
+
# NOTE: Queue is Deprecated, please use BasicQueue
|
4
|
+
#
|
2
5
|
class Queue
|
3
|
-
|
6
|
+
|
4
7
|
attr_reader :options, :name, :channel, :q, :ex
|
5
|
-
|
8
|
+
|
6
9
|
class_attribute :cached_queues
|
7
|
-
|
10
|
+
|
8
11
|
def initialize(name, options = {})
|
9
12
|
self.class.cached_queues ||= {}
|
10
|
-
|
13
|
+
|
11
14
|
options = {
|
12
15
|
:auto_delete => false,
|
13
16
|
:durable => true
|
14
17
|
}.update(options)
|
15
|
-
|
18
|
+
|
16
19
|
@name, @options = name, options
|
17
|
-
|
20
|
+
|
18
21
|
setup
|
19
22
|
p self.cached_queues.keys
|
20
|
-
|
23
|
+
|
21
24
|
log.debug(tag)
|
22
25
|
purge
|
23
26
|
end
|
24
|
-
|
27
|
+
|
25
28
|
def purge
|
26
29
|
q.purge
|
27
30
|
end
|
28
|
-
|
31
|
+
|
29
32
|
def inspect
|
30
33
|
"<#{self.class.name} name=#{name} exchange=#{ex ? ex.name : 'nil'}>"
|
31
34
|
end
|
32
|
-
|
35
|
+
|
33
36
|
def log
|
34
37
|
Cloudist.log
|
35
38
|
end
|
@@ -40,38 +43,38 @@ module Cloudist
|
|
40
43
|
a << "exchange=#{ex.name}" if ex
|
41
44
|
}.join(' ')
|
42
45
|
end
|
43
|
-
|
46
|
+
|
44
47
|
def publish(msg)
|
45
48
|
raise ArgumentError, "Publish expects a Cloudist::Message object" unless msg.is_a?(Cloudist::Message)
|
46
|
-
|
49
|
+
|
47
50
|
body, headers = msg.encoded
|
48
51
|
# EM.defer {
|
49
52
|
publish_to_ex(body, headers)
|
50
53
|
# }
|
51
|
-
|
54
|
+
|
52
55
|
p msg.body.to_hash
|
53
56
|
end
|
54
|
-
|
57
|
+
|
55
58
|
# def channel
|
56
59
|
# self.class.channel
|
57
60
|
# end
|
58
|
-
#
|
61
|
+
#
|
59
62
|
# def q
|
60
63
|
# self.class.q
|
61
64
|
# end
|
62
|
-
#
|
65
|
+
#
|
63
66
|
# def ex
|
64
67
|
# self.class.ex
|
65
68
|
# end
|
66
|
-
|
69
|
+
|
67
70
|
def publish_to_ex(body, headers = {})
|
68
71
|
ex.publish(body, headers)
|
69
72
|
end
|
70
|
-
|
73
|
+
|
71
74
|
def publish_to_q(body, headers = {})
|
72
75
|
q.publish(body, headers)
|
73
76
|
end
|
74
|
-
|
77
|
+
|
75
78
|
def teardown
|
76
79
|
q.unsubscribe
|
77
80
|
channel.close
|
@@ -81,34 +84,34 @@ module Cloudist
|
|
81
84
|
def destroy
|
82
85
|
teardown
|
83
86
|
end
|
84
|
-
|
87
|
+
|
85
88
|
def subscribe(options = {}, &block)
|
86
89
|
options[:ack] = true
|
87
90
|
q.subscribe(options) do |queue_header, encoded_message|
|
88
91
|
request = Cloudist::Request.new(self, encoded_message, queue_header)
|
89
|
-
|
92
|
+
|
90
93
|
msg = Cloudist::Message.new(*request.for_message)
|
91
|
-
|
94
|
+
|
92
95
|
EM.defer do
|
93
96
|
begin
|
94
97
|
raise Cloudist::ExpiredMessage if request.expired?
|
95
98
|
yield msg
|
96
|
-
|
99
|
+
|
97
100
|
rescue Cloudist::ExpiredMessage
|
98
101
|
log.error "AMQP Message Timeout: #{tag} ttl=#{request.ttl} age=#{request.age}"
|
99
|
-
|
102
|
+
|
100
103
|
rescue Exception => e
|
101
104
|
Cloudist.handle_error(e)
|
102
|
-
|
105
|
+
|
103
106
|
ensure
|
104
107
|
request.ack unless Cloudist.closing?
|
105
108
|
end
|
106
109
|
end
|
107
110
|
end
|
108
111
|
end
|
109
|
-
|
112
|
+
|
110
113
|
private
|
111
|
-
|
114
|
+
|
112
115
|
def setup
|
113
116
|
if self.class.cached_queues.keys.include?(name.to_sym)
|
114
117
|
@q = self.class.cached_queues[name.to_sym][:q]
|
@@ -126,27 +129,27 @@ module Cloudist
|
|
126
129
|
end
|
127
130
|
setup_binding
|
128
131
|
end
|
129
|
-
|
132
|
+
|
130
133
|
def setup_channel
|
131
134
|
@channel = ::AMQP::Channel.new
|
132
|
-
|
135
|
+
|
133
136
|
# Set up QOS. If you do not do this then the subscribe in receive_message
|
134
137
|
# will get overwelmd and the whole thing will collapse in on itself.
|
135
138
|
channel.prefetch(1)
|
136
139
|
end
|
137
|
-
|
140
|
+
|
138
141
|
def setup_queue
|
139
142
|
@q = channel.queue(name, options)
|
140
143
|
end
|
141
|
-
|
144
|
+
|
142
145
|
def setup_exchange
|
143
146
|
@ex = channel.direct(name)
|
144
147
|
# setup_binding
|
145
148
|
end
|
146
|
-
|
149
|
+
|
147
150
|
def setup_binding
|
148
151
|
q.bind(ex)
|
149
152
|
end
|
150
|
-
|
153
|
+
|
151
154
|
end
|
152
155
|
end
|