rservicebus 0.0.32 → 0.0.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -89,11 +89,11 @@ class HandlerLoader
89
89
  # Assigns appropriate resources to writable attributes in the handler that match keys in the resource hash
90
90
  #
91
91
  # @param [RServiceBus::Handler] handler
92
- # @param [Hash] appResources As hash[k,v] where k is the name of a resource, and v is the resource
93
- def setAppResources( handler, appResources )
92
+ ## @param [Hash] appResources As hash[k,v] where k is the name of a resource, and v is the resource
93
+ def setAppResources( handler )
94
94
  @host.log "Checking app resources for: #{handler.class.name}", true
95
95
  @host.log "If your attribute is not getting set, check that it is in the 'attr_accessor' list", true
96
- appResources.each do |k,v|
96
+ @appResources.each do |k,v|
97
97
  if handler.class.method_defined?( k ) then
98
98
  handler.instance_variable_set( "@#{k}", v.getResource() )
99
99
  @resourceList[handler.class.name] = Array.new if @resourceList[handler.class.name].nil?
@@ -101,7 +101,7 @@ class HandlerLoader
101
101
  @host.log "App resource attribute, #{k}, set for: " + handler.class.name
102
102
  end
103
103
  end
104
-
104
+
105
105
  return self
106
106
  end
107
107
 
@@ -117,7 +117,7 @@ class HandlerLoader
117
117
 
118
118
  handler = self.loadHandlerFromFile( handlerName, filePath )
119
119
  self.setBusAttributeIfRequested( handler )
120
- self.setAppResources( handler, @appResources )
120
+ self.setAppResources( handler )
121
121
  @host.log "Loaded Handler: " + handlerName
122
122
 
123
123
  return handler
@@ -59,14 +59,14 @@ module RServiceBus
59
59
 
60
60
  def loadHandlers()
61
61
  log "Load Message Handlers"
62
- handlerLoader = HandlerLoader.new( self, @appResources )
62
+ @handlerLoader = HandlerLoader.new( self, @appResources )
63
63
 
64
64
  @config.handlerPathList.each do |path|
65
- handlerLoader.loadHandlersFromPath(path)
65
+ @handlerLoader.loadHandlersFromPath(path)
66
66
  end
67
67
 
68
- @handlerList = handlerLoader.handlerList
69
- @resourceByHandlerNameList = handlerLoader.resourceList
68
+ @handlerList = @handlerLoader.handlerList
69
+ @resourceByHandlerNameList = @handlerLoader.resourceList
70
70
 
71
71
  return self
72
72
  end
@@ -185,12 +185,13 @@ module RServiceBus
185
185
  @handlerList[@msg.msg.class.name].each do |handler|
186
186
  @resourceByHandlerNameList[handler.class.name].each do |resource|
187
187
  resource.reconnect
188
+ @handlerLoader.setAppResources( handler )
188
189
  end
189
190
  end
190
-
191
-
191
+
192
+
192
193
  retry if (retries -= 1) > 0
193
-
194
+
194
195
  @stats.incTotalErrored
195
196
  if e.class.name == "Beanstalk::NotConnected" then
196
197
  puts "Lost connection to beanstalkd."
@@ -306,13 +307,16 @@ module RServiceBus
306
307
  @stats.incTotalSent
307
308
 
308
309
  msgName = msg.class.name
309
- if !@config.messageEndpointMappings.has_key?( msgName ) then
310
+ if @config.messageEndpointMappings.has_key?( msgName ) then
311
+ queueName = @config.messageEndpointMappings[msgName]
312
+ elsif !@handlerList[msgName].nil? then
313
+ queueName = @config.localQueueName
314
+ else
310
315
  log "No end point mapping found for: " + msgName
311
- log "**** Check in RServiceBus.yml that the section MessageEndpointMappings contains an entry named : " + msgName
316
+ log "**** Check environment variable MessageEndpointMappings contains an entry named : " + msgName
312
317
  raise "No end point mapping found for: " + msgName
313
318
  end
314
319
 
315
- queueName = @config.messageEndpointMappings[msgName]
316
320
 
317
321
  self._SendNeedsWrapping( msg, queueName )
318
322
  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.32
4
+ version: 0.0.34
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: 2012-11-05 00:00:00.000000000 Z
12
+ date: 2012-11-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A Ruby interpretation of NServiceBus
15
15
  email: guy@guyirvine.com