rservicebus 0.1.71 → 0.1.72
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/rservicebus-create +2 -2
- data/lib/rservicebus/Config.rb +41 -41
- metadata +11 -12
- data/README.md +0 -21
data/bin/rservicebus-create
CHANGED
@@ -39,7 +39,7 @@ end
|
|
39
39
|
def procfile( name )
|
40
40
|
|
41
41
|
content = %{
|
42
|
-
#{name}: env APPNAME=#{name.capitalize} VERBOSE=true MAX_RETRIES=0 WORKING_DIR
|
42
|
+
#{name}: env APPNAME=#{name.capitalize} VERBOSE=true MAX_RETRIES=0 WORKING_DIR=#{Dir.pwd} rservicebus
|
43
43
|
|
44
44
|
}
|
45
45
|
|
@@ -56,7 +56,7 @@ content = %{
|
|
56
56
|
class MessageHandler_First
|
57
57
|
|
58
58
|
def Handle( msg )
|
59
|
-
|
59
|
+
|
60
60
|
end
|
61
61
|
|
62
62
|
end
|
data/lib/rservicebus/Config.rb
CHANGED
@@ -1,40 +1,40 @@
|
|
1
1
|
module RServiceBus
|
2
|
-
|
2
|
+
|
3
3
|
#Marshals configuration information for an rservicebus host
|
4
4
|
class Config
|
5
5
|
attr_reader :appName, :messageEndpointMappings, :handlerPathList, :sagaPathList, :errorQueueName, :maxRetries, :forwardReceivedMessagesTo, :subscriptionUri, :statOutputCountdown, :contractList, :libList, :forwardSentMessagesTo, :mqHost
|
6
|
-
|
6
|
+
|
7
7
|
@appName
|
8
8
|
@messageEndpointMappings
|
9
9
|
@handlerPathList
|
10
10
|
@sagaPathList
|
11
11
|
@contractList
|
12
|
-
|
12
|
+
|
13
13
|
@errorQueueName
|
14
14
|
@forwardSentMessagesTo
|
15
15
|
@maxRetries
|
16
16
|
@forwardReceivedMessagesTo
|
17
17
|
@subscriptionUri
|
18
|
-
|
18
|
+
|
19
19
|
@mq
|
20
|
-
|
20
|
+
|
21
21
|
def initialize()
|
22
22
|
puts "Cannot instantiate config directly."
|
23
23
|
puts "For production, use ConfigFromEnv."
|
24
24
|
puts "For debugging or testing, you could try ConfigFromSetter"
|
25
25
|
abort()
|
26
26
|
end
|
27
|
-
|
27
|
+
|
28
28
|
def log( string )
|
29
29
|
puts string
|
30
30
|
end
|
31
|
-
|
31
|
+
|
32
32
|
def getValue( name, default=nil )
|
33
33
|
value = ( ENV[name].nil? || ENV[name] == "" ) ? default : ENV[name];
|
34
34
|
log "Env value: #{name}: #{value}"
|
35
35
|
return value
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
38
|
#Marshals paths for message handlers
|
39
39
|
#
|
40
40
|
#Note. trailing slashs will be stripped
|
@@ -48,10 +48,10 @@ module RServiceBus
|
|
48
48
|
path = path.strip.chomp( "/" )
|
49
49
|
@handlerPathList << path
|
50
50
|
end
|
51
|
-
|
51
|
+
|
52
52
|
return self
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def loadSagaPathList()
|
56
56
|
path = self.getValue( "SAGAPATH", "./Saga" )
|
57
57
|
@sagaPathList = Array.new
|
@@ -59,17 +59,17 @@ module RServiceBus
|
|
59
59
|
path = path.strip.chomp( "/" )
|
60
60
|
@sagaPathList << path
|
61
61
|
end
|
62
|
-
|
62
|
+
|
63
63
|
return self
|
64
64
|
end
|
65
|
-
|
65
|
+
|
66
66
|
def loadHostSection()
|
67
67
|
@appName = self.getValue( "APPNAME", "RServiceBus" )
|
68
68
|
@errorQueueName = self.getValue( "ERROR_QUEUE_NAME", "error" )
|
69
69
|
@maxRetries = self.getValue( "MAX_RETRIES", "5" ).to_i
|
70
70
|
@statOutputCountdown = self.getValue( "STAT_OUTPUT_COUNTDOWN", "100" ).to_i
|
71
71
|
@subscriptionUri = self.getValue( "SUBSCRIPTION_URI", "file:///tmp/#{appName}_subscriptions.yaml" )
|
72
|
-
|
72
|
+
|
73
73
|
auditQueueName = self.getValue( "AUDIT_QUEUE_NAME" )
|
74
74
|
if auditQueueName.nil? then
|
75
75
|
@forwardSentMessagesTo = self.getValue( "FORWARD_SENT_MESSAGES_TO" )
|
@@ -78,10 +78,10 @@ module RServiceBus
|
|
78
78
|
@forwardSentMessagesTo = auditQueueName
|
79
79
|
@forwardReceivedMessagesTo = auditQueueName
|
80
80
|
end
|
81
|
-
|
81
|
+
|
82
82
|
return self
|
83
83
|
end
|
84
|
-
|
84
|
+
|
85
85
|
def ensureContractFileExists( path )
|
86
86
|
if !( File.exists?( path ) ||
|
87
87
|
File.exists?( "#{path}.rb" ) ) then
|
@@ -96,7 +96,7 @@ module RServiceBus
|
|
96
96
|
abort()
|
97
97
|
end
|
98
98
|
end
|
99
|
-
|
99
|
+
|
100
100
|
#Marshals paths for contracts
|
101
101
|
#
|
102
102
|
#Note. .rb extension is optional
|
@@ -105,20 +105,20 @@ module RServiceBus
|
|
105
105
|
# /one/two/Contracts
|
106
106
|
def loadContracts()
|
107
107
|
@contractList = Array.new
|
108
|
-
|
108
|
+
|
109
109
|
#This is a guard clause in case no Contracts have been specified
|
110
110
|
#If any guard clauses have been specified, then execution should drop to the second block
|
111
111
|
if self.getValue( "CONTRACTS" ).nil? then
|
112
112
|
return self
|
113
113
|
end
|
114
|
-
|
114
|
+
|
115
115
|
self.getValue( "CONTRACTS", "./Contract" ).split( ";" ).each do |path|
|
116
116
|
self.ensureContractFileExists( path )
|
117
117
|
@contractList << path
|
118
118
|
end
|
119
119
|
return self
|
120
120
|
end
|
121
|
-
|
121
|
+
|
122
122
|
#Marshals paths for lib
|
123
123
|
#
|
124
124
|
#Note. .rb extension is optional
|
@@ -127,13 +127,13 @@ module RServiceBus
|
|
127
127
|
# /one/two/Contracts
|
128
128
|
def loadLibs()
|
129
129
|
@libList = Array.new
|
130
|
-
|
130
|
+
|
131
131
|
path = self.getValue( "LIB" )
|
132
132
|
path = "./lib" if path.nil? and File.exists?( "./lib" )
|
133
133
|
if path.nil? then
|
134
134
|
return self
|
135
135
|
end
|
136
|
-
|
136
|
+
|
137
137
|
path.split( ";" ).each do |path|
|
138
138
|
log "Loading libs from, #{path}"
|
139
139
|
if !File.exists?( path ) then
|
@@ -146,12 +146,12 @@ module RServiceBus
|
|
146
146
|
end
|
147
147
|
return self
|
148
148
|
end
|
149
|
-
|
149
|
+
|
150
150
|
def configureMq
|
151
151
|
@mqHost = self.getValue( "MQ", "beanstalk://localhost" )
|
152
152
|
return self
|
153
153
|
end
|
154
|
-
|
154
|
+
|
155
155
|
#Marshals paths for working_dirs
|
156
156
|
#
|
157
157
|
#Note. trailing slashs will be stripped
|
@@ -161,54 +161,54 @@ module RServiceBus
|
|
161
161
|
def loadWorkingDirList()
|
162
162
|
pathList = self.getValue( "WORKING_DIR" )
|
163
163
|
return self if pathList.nil?
|
164
|
-
|
164
|
+
|
165
165
|
pathList.split( ";" ).each do |path|
|
166
|
-
|
166
|
+
|
167
167
|
path = path.strip.chomp( "/" )
|
168
|
-
|
168
|
+
|
169
169
|
if !Dir.exists?( "#{path}" ) then
|
170
170
|
puts "Error while processing working directory list"
|
171
171
|
puts "*** path, #{path}, does not exist"
|
172
172
|
next
|
173
173
|
end
|
174
|
-
|
174
|
+
|
175
175
|
if Dir.exists?( "#{path}/MessageHandler" ) then
|
176
176
|
@handlerPathList << "#{path}/MessageHandler"
|
177
177
|
end
|
178
|
-
|
178
|
+
|
179
179
|
if Dir.exists?( "#{path}/Saga" ) then
|
180
180
|
@sagaPathList << "#{path}/Saga"
|
181
181
|
end
|
182
|
-
|
182
|
+
|
183
183
|
if File.exists?( "#{path}/Contract.rb" ) then
|
184
184
|
@contractList << "#{path}/Contract.rb"
|
185
185
|
end
|
186
|
-
|
186
|
+
|
187
187
|
if File.exists?( "#{path}/lib" ) then
|
188
188
|
@libList << "#{path}/lib"
|
189
189
|
end
|
190
190
|
end
|
191
|
-
|
191
|
+
|
192
192
|
return self
|
193
193
|
end
|
194
|
-
|
194
|
+
|
195
195
|
end
|
196
|
-
|
197
|
-
|
196
|
+
|
197
|
+
|
198
198
|
class ConfigFromEnv<Config
|
199
|
-
|
199
|
+
|
200
200
|
def initialize()
|
201
201
|
end
|
202
|
-
|
202
|
+
|
203
203
|
end
|
204
|
-
|
204
|
+
|
205
205
|
class ConfigFromSetter<Config
|
206
206
|
attr_writer :appName, :messageEndpointMappings, :handlerPathList, :errorQueueName, :maxRetries, :forwardReceivedMessagesTo, :beanstalkHost
|
207
|
-
|
207
|
+
|
208
208
|
def initialize()
|
209
209
|
end
|
210
|
-
|
210
|
+
|
211
211
|
end
|
212
|
-
|
213
|
-
|
212
|
+
|
213
|
+
|
214
214
|
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.1.
|
4
|
+
version: 0.1.72
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2014-08-03 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: uuidtools
|
16
|
-
requirement: &
|
16
|
+
requirement: &70281931070860 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70281931070860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: json
|
27
|
-
requirement: &
|
27
|
+
requirement: &70281931070380 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70281931070380
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: beanstalk-client
|
38
|
-
requirement: &
|
38
|
+
requirement: &70281931069940 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70281931069940
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: fluiddb
|
49
|
-
requirement: &
|
49
|
+
requirement: &70281931069480 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70281931069480
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: parse-cron
|
60
|
-
requirement: &
|
60
|
+
requirement: &70281931069020 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :runtime
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70281931069020
|
69
69
|
description: A Ruby interpretation of NServiceBus
|
70
70
|
email: guy@guyirvine.com
|
71
71
|
executables:
|
@@ -158,7 +158,6 @@ files:
|
|
158
158
|
- bin/rservicebus-transport
|
159
159
|
- bin/SendEmptyMessage
|
160
160
|
- LICENSE
|
161
|
-
- README.md
|
162
161
|
homepage: http://rubygems.org/gems/rservicebus
|
163
162
|
licenses: []
|
164
163
|
post_install_message:
|
data/README.md
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
#RServiceBus
|
2
|
-
|
3
|
-
A Ruby interpretation of NServiceBus
|
4
|
-
|
5
|
-
##Principles
|
6
|
-
*Why are you doing it and what can go wrong
|
7
|
-
*Dont solve infrastructure problems with software
|
8
|
-
*Infrastructure in this case refers to anything not specific to the application domain
|
9
|
-
|
10
|
-
##Queues
|
11
|
-
* Queues specified by config, determined by message type
|
12
|
-
|
13
|
-
##Transport
|
14
|
-
* beanstalk
|
15
|
-
|
16
|
-
##MessageHandler
|
17
|
-
* Name by convention - Handler name matchs filename
|
18
|
-
* Single handler for message is in top level file
|
19
|
-
* Multiple handlers for message are in files under top level directory
|
20
|
-
* Handlers are dynamically loaded
|
21
|
-
* If a handler fails to load, the service wont start - infrastructure problem
|