tengine_event 0.4.6
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.rspec +1 -0
- data/Gemfile +26 -0
- data/Gemfile.lock +64 -0
- data/README.rdoc +21 -0
- data/Rakefile +51 -0
- data/VERSION +1 -0
- data/bin/tengine_event_sucks +48 -0
- data/bin/tengine_fire +46 -0
- data/lib/tengine/event/model_notifiable.rb +49 -0
- data/lib/tengine/event/sender.rb +125 -0
- data/lib/tengine/event.rb +184 -0
- data/lib/tengine/mq/suite.rb +1102 -0
- data/lib/tengine/mq.rb +5 -0
- data/lib/tengine/null_logger.rb +10 -0
- data/lib/tengine_event.rb +13 -0
- data/spec/.gitignore +1 -0
- data/spec/mq_config.yml.example +13 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/tengine/event/model_notifiable_spec.rb +80 -0
- data/spec/tengine/event/sender_spec.rb +124 -0
- data/spec/tengine/event_spec.rb +397 -0
- data/spec/tengine/mq/connect_actually_spec.rb +38 -0
- data/spec/tengine/mq/suite_spec.rb +981 -0
- data/spec/tengine/null_logger_spec.rb +13 -0
- data/spec/tengine_spec.rb +17 -0
- data/tengine_event.gemspec +96 -0
- metadata +203 -0
@@ -0,0 +1,38 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
|
3
|
+
|
4
|
+
require 'amqp'
|
5
|
+
|
6
|
+
config_filepath = File.expand_path("../../mq_config.yml", File.dirname(__FILE__))
|
7
|
+
|
8
|
+
if File.exist?(config_filepath) && (ENV['TENGINE_EVENT_MQ_TEST'] =~ /true|on/i)
|
9
|
+
describe "Tengine::Mq::Suite" do
|
10
|
+
before do
|
11
|
+
# キューをsubscribeすることで、キューを作ります
|
12
|
+
@config = YAML.load_file(config_filepath)
|
13
|
+
EM.run do
|
14
|
+
@mq_suite = Tengine::Mq::Suite.new(@config)
|
15
|
+
@mq_suite.queue.subscribe do |metadata, msg|
|
16
|
+
# 何もしません
|
17
|
+
end
|
18
|
+
EM.add_timer(1) do
|
19
|
+
@mq_suite.connection.close{ EM.stop_event_loop }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
it "EM.run{...} を複数回実行できる" do
|
25
|
+
EM.run{
|
26
|
+
@mq_suite.exchange.publish("foo"){
|
27
|
+
@mq_suite.connection.close{ EM.stop_event_loop }
|
28
|
+
}
|
29
|
+
}
|
30
|
+
EM.run{
|
31
|
+
@mq_suite.exchange.publish("foo"){
|
32
|
+
@mq_suite.connection.close{ EM.stop_event_loop }
|
33
|
+
}
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
38
|
+
end
|