rservicebus 0.1.12 → 0.1.13
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rservicebus/Host.rb +14 -1
- data/lib/rservicebus/helper_functions.rb +0 -9
- metadata +1 -1
data/lib/rservicebus/Host.rb
CHANGED
@@ -7,6 +7,8 @@ module RServiceBus
|
|
7
7
|
end
|
8
8
|
class NoMsgToProcess<StandardError
|
9
9
|
end
|
10
|
+
class PropertyNotSet<StandardError
|
11
|
+
end
|
10
12
|
|
11
13
|
#Host process for rservicebus
|
12
14
|
class Host
|
@@ -214,14 +216,23 @@ module RServiceBus
|
|
214
216
|
serialized_object = YAML::dump(@msg)
|
215
217
|
self._SendAlreadyWrappedAndSerialised(serialized_object, @config.errorQueueName)
|
216
218
|
@mq.ack
|
219
|
+
|
217
220
|
rescue NoHandlerFound => e
|
218
221
|
puts "*** Handler not found for msg, #{e.message}"
|
219
222
|
puts "*** Ensure a handler named, #{e.message}, is present in the MessageHandler directory."
|
220
|
-
|
223
|
+
|
221
224
|
@msg.addErrorMsg( @config.localQueueName, e.message )
|
222
225
|
serialized_object = YAML::dump(@msg)
|
223
226
|
self._SendAlreadyWrappedAndSerialised(serialized_object, @config.errorQueueName)
|
224
227
|
@mq.ack
|
228
|
+
|
229
|
+
rescue PropertyNotSet => e
|
230
|
+
#This has been re-rasied from a rescue in the handler
|
231
|
+
puts "*** #{e.message}"
|
232
|
+
#"Property, #{e.message}, not set for, #{handler.class.name}"
|
233
|
+
propertyName = e.message[10, e.message.index(",", 10)-10]
|
234
|
+
puts "*** Ensure the environemnt variable, RSB_#{propertyName}, has been set at startup."
|
235
|
+
|
225
236
|
rescue Exception => e
|
226
237
|
sleep 0.5
|
227
238
|
|
@@ -304,6 +315,8 @@ module RServiceBus
|
|
304
315
|
log "Handler, #{handler.class.name}, started processing msg, #{msgName}"
|
305
316
|
handler.Handle( @msg.msg )
|
306
317
|
log "Handler, #{handler.class.name}, finished processing msg, #{msgName}"
|
318
|
+
rescue PropertyNotSet => e
|
319
|
+
raise PropertyNotSet.new( "Property, #{e.message}, not set for, #{handler.class.name}" )
|
307
320
|
rescue Exception => e
|
308
321
|
puts "E #{e.message}"
|
309
322
|
log "An error occured in Handler: " + handler.class.name
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module RServiceBus
|
2
2
|
|
3
|
-
class PropertyNotSet<StandardError
|
4
|
-
end
|
5
3
|
|
6
4
|
def RServiceBus.convertDTOToHash( obj )
|
7
5
|
hash = {};
|
@@ -47,11 +45,4 @@ module RServiceBus
|
|
47
45
|
|
48
46
|
end
|
49
47
|
|
50
|
-
def RServiceBus.RaisePropertyNotSet( propertyName, handlerName, explaination )
|
51
|
-
puts "*** Set RSB_#{propertyName} for, #{handlerName}"
|
52
|
-
puts explaination
|
53
|
-
|
54
|
-
raise PropertyNotSet.new( error )
|
55
|
-
end
|
56
|
-
|
57
48
|
end
|