modern_times 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/modern_times/jms/connection.rb +4 -2
- data/lib/modern_times/jms_requestor/requestor.rb +6 -0
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.4
|
@@ -11,11 +11,13 @@ module ModernTimes
|
|
11
11
|
def init(config)
|
12
12
|
@config = config
|
13
13
|
@inited = true
|
14
|
-
|
15
|
-
@connection.start
|
14
|
+
|
16
15
|
# Let's not create a session_pool unless we're going to use it
|
17
16
|
@session_pool_mutex = Mutex.new
|
18
17
|
|
18
|
+
@connection = ::JMS::Connection.new(config)
|
19
|
+
@connection.start
|
20
|
+
|
19
21
|
at_exit do
|
20
22
|
close
|
21
23
|
end
|
@@ -3,8 +3,12 @@ module ModernTimes
|
|
3
3
|
class Requestor < ModernTimes::JMS::Publisher
|
4
4
|
attr_reader :reply_queue
|
5
5
|
|
6
|
+
@@dummy_requesting = false
|
7
|
+
|
6
8
|
def initialize(options)
|
7
9
|
super
|
10
|
+
return if @@dummy_requesting
|
11
|
+
raise "ModernTimes::JMS::Connection has not been initialized" unless ModernTimes::JMS::Connection.inited?
|
8
12
|
ModernTimes::JMS::Connection.session_pool.session do |session|
|
9
13
|
@reply_queue = session.create_destination(:queue_name => :temporary)
|
10
14
|
end
|
@@ -30,6 +34,7 @@ module ModernTimes
|
|
30
34
|
end
|
31
35
|
|
32
36
|
def self.setup_dummy_requesting(workers)
|
37
|
+
@@dummy_requesting = true
|
33
38
|
@@worker_instances = workers.map {|worker| worker.new}
|
34
39
|
alias_method :real_request, :request
|
35
40
|
alias_method :request, :dummy_request
|
@@ -37,6 +42,7 @@ module ModernTimes
|
|
37
42
|
|
38
43
|
# For testing
|
39
44
|
def self.clear_dummy_requesting
|
45
|
+
@@dummy_requesting = false
|
40
46
|
alias_method :dummy_request, :request
|
41
47
|
alias_method :request, :real_request
|
42
48
|
end
|