rservicebus 0.0.65 → 0.0.66
Sign up to get free protection for your applications and to get access to all the features.
data/lib/rservicebus/Config.rb
CHANGED
@@ -89,8 +89,8 @@ module RServiceBus
|
|
89
89
|
@maxRetries = self.getValue( "MAX_RETRIES", "5" ).to_i
|
90
90
|
@queueTimeout = self.getValue( "QUEUE_TIMEOUT", "5" ).to_i
|
91
91
|
@statOutputCountdown = self.getValue( "STAT_OUTPUT_COUNTDOWN", "100" ).to_i
|
92
|
-
@subscriptionUri = self.getValue( "SUBSCRIPTION_URI", "
|
93
|
-
|
92
|
+
@subscriptionUri = self.getValue( "SUBSCRIPTION_URI", "marshal:///tmp/#{appName}_subscriptions.yaml" )
|
93
|
+
|
94
94
|
auditQueueName = self.getValue( "AUDIT_QUEUE_NAME" )
|
95
95
|
if auditQueueName.nil? then
|
96
96
|
@forwardSentMessagesTo = self.getValue( "FORWARD_SENT_MESSAGES_TO" )
|
@@ -13,6 +13,10 @@ module RServiceBus
|
|
13
13
|
require "rservicebus/SubscriptionStorage/Redis"
|
14
14
|
s = SubscriptionStorage_Redis.new( appName, uri )
|
15
15
|
|
16
|
+
when "marshal"
|
17
|
+
require "rservicebus/SubscriptionStorage/Marshal"
|
18
|
+
s = SubscriptionStorage_Marshal.new( appName, uri )
|
19
|
+
|
16
20
|
else
|
17
21
|
abort("Scheme, #{uri.scheme}, not recognised when configuring subscription storage, #{uri_string}");
|
18
22
|
end
|
@@ -6,6 +6,7 @@ require "uri"
|
|
6
6
|
#
|
7
7
|
class SubscriptionStorage
|
8
8
|
@appName
|
9
|
+
@uri
|
9
10
|
|
10
11
|
# Constructor
|
11
12
|
#
|
@@ -13,6 +14,7 @@ class SubscriptionStorage
|
|
13
14
|
# @param [String] uri a location for the resource to which we will attach, eg redis://127.0.0.1/foo
|
14
15
|
def initialize(appName, uri)
|
15
16
|
@appName = appName
|
17
|
+
@uri = uri
|
16
18
|
end
|
17
19
|
|
18
20
|
# Get a list of all subscription, as an Array
|
@@ -0,0 +1,46 @@
|
|
1
|
+
module RServiceBus
|
2
|
+
|
3
|
+
#Implementation of Subscription Storage to Redis
|
4
|
+
class SubscriptionStorage_Marshal<SubscriptionStorage
|
5
|
+
|
6
|
+
@path
|
7
|
+
|
8
|
+
# Constructor
|
9
|
+
#
|
10
|
+
# @param [String] appName Name of the application, which is used as a Namespace
|
11
|
+
# @param [String] uri a location for the resource to which we will attach, eg redis://127.0.0.1/foo
|
12
|
+
def initialize( appName, uri )
|
13
|
+
super(appName, uri)
|
14
|
+
end
|
15
|
+
|
16
|
+
def getAll
|
17
|
+
RServiceBus.log "Load subscriptions"
|
18
|
+
return Hash.new unless File.exists?( @uri.path )
|
19
|
+
|
20
|
+
return YAML::load( File.open( @uri.path ) )
|
21
|
+
end
|
22
|
+
|
23
|
+
def add( eventName, queueName )
|
24
|
+
if File.exists?( @uri.path ) then
|
25
|
+
subscriptions = YAML::load( File.open( @uri.path ) )
|
26
|
+
else
|
27
|
+
subscriptions = Hash.new
|
28
|
+
end
|
29
|
+
|
30
|
+
subscriptions[eventName] = Array.new if subscriptions[eventName].nil?
|
31
|
+
|
32
|
+
subscriptions[eventName] << queueName
|
33
|
+
subscriptions[eventName] = subscriptions[eventName].uniq
|
34
|
+
|
35
|
+
IO.write( @uri.path, YAML::dump(subscriptions ) )
|
36
|
+
|
37
|
+
return subscriptions
|
38
|
+
end
|
39
|
+
|
40
|
+
def remove( eventName, queueName )
|
41
|
+
raise "Method, remove, needs to be implemented for this subscription storage"
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.66
|
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-05-
|
12
|
+
date: 2013-05-13 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: A Ruby interpretation of NServiceBus
|
15
15
|
email: guy@guyirvine.com
|
@@ -59,6 +59,7 @@ files:
|
|
59
59
|
- lib/rservicebus/Saga.rb
|
60
60
|
- lib/rservicebus/Stats.rb
|
61
61
|
- lib/rservicebus/SubscriptionManager.rb
|
62
|
+
- lib/rservicebus/SubscriptionStorage/Marshal.rb
|
62
63
|
- lib/rservicebus/SubscriptionStorage/Redis.rb
|
63
64
|
- lib/rservicebus/SubscriptionStorage.rb
|
64
65
|
- lib/rservicebus/Test/Bus.rb
|