rservicebus 0.0.4 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -79,7 +79,7 @@ class Config
79
79
  end
80
80
 
81
81
  self.getValue( "CONTRACTS" ).split( ";" ).each do |path|
82
- self.log "Loading contracts from, #{path}"
82
+ puts "Loading contracts from, #{path}"
83
83
  require path
84
84
  end
85
85
  return self
@@ -29,18 +29,20 @@ class Host
29
29
  return self;
30
30
  end
31
31
 
32
- def connectTpBeanstalk
32
+ def connectToBeanstalk
33
33
  begin
34
- @beanstalk = Beanstalk::Pool.new([@beanstalkHost])
34
+ @beanstalk = Beanstalk::Pool.new([@config.beanstalkHost])
35
35
  rescue Exception => e
36
+ puts "Error connecting to Beanstalk"
37
+ puts "Host string, #{@config.beanstalkHost}"
36
38
  if e.message == "Beanstalk::NotConnected" then
37
- puts "Error connecting to Beanstalk"
38
39
  puts "***Most likely, beanstalk is not running. Start beanstalk, and try running this again."
39
40
  puts "***If you still get this error, check beanstalk is running at, " + beanstalkHost
40
- abort()
41
41
  else
42
- raise e
42
+ puts e.message
43
+ puts e.backtrace
43
44
  end
45
+ abort()
44
46
  end
45
47
 
46
48
  return self
@@ -57,7 +59,7 @@ class Host
57
59
  .loadHandlerPathList();
58
60
 
59
61
  self.configureAppResource()
60
- .connectTpBeanstalk()
62
+ .connectToBeanstalk()
61
63
  .loadHandlers()
62
64
  .loadSubscriptions()
63
65
  .sendSubscriptions()
@@ -188,11 +190,18 @@ class Host
188
190
  retry if (retries -= 1) > 0
189
191
 
190
192
  errorString = e.message + ". " + e.backtrace[0]
193
+ if e.backtrace.length > 1 then
194
+ errorString = errorString + ". " + e.backtrace[1]
195
+ end
196
+ if e.backtrace.length > 2 then
197
+ errorString = errorString + ". " + e.backtrace[2]
198
+ end
191
199
  log errorString
192
200
 
193
201
  @msg.addErrorMsg( @config.localQueueName, errorString )
194
202
  serialized_object = YAML::dump(@msg)
195
203
  self._SendAlreadyWrappedAndSerialised(serialized_object, @config.errorQueueName)
204
+ job.delete
196
205
  end
197
206
  end
198
207
  end
@@ -259,7 +268,6 @@ class Host
259
268
  def Publish( msg )
260
269
  log "Bus.Publish", true
261
270
 
262
-
263
271
  subscription = @subscriptions[msg.class.name]
264
272
  if subscription.nil? then
265
273
  log "No subscribers for event, " + msg.class.name
@@ -270,7 +278,6 @@ class Host
270
278
  self._SendNeedsWrapping( msg, subscriber )
271
279
  end
272
280
 
273
-
274
281
  end
275
282
 
276
283
  def Subscribe( eventName )
@@ -0,0 +1,3 @@
1
+ require "rservicebus/Test/Bus"
2
+ require "rservicebus/Test/Redis"
3
+
@@ -0,0 +1,24 @@
1
+ module RServiceBus
2
+
3
+ class Test_Bus
4
+ attr_accessor :publishList, :sendList
5
+ @publishList
6
+ @sendList
7
+
8
+ def initialize
9
+ @publishList = Array.new
10
+ @sendList = Array.new
11
+ end
12
+
13
+ def Publish( msg )
14
+ @publishList << msg
15
+ end
16
+
17
+ def Send( msg )
18
+ @sendList << msg
19
+ end
20
+ end
21
+
22
+ end
23
+
24
+
@@ -0,0 +1,31 @@
1
+ module RServiceBus
2
+
3
+ class Test_Redis
4
+
5
+ @keyHash = Hash.new
6
+
7
+ def initialize
8
+ @keyHash = Hash.new
9
+ end
10
+
11
+ def get( key )
12
+ return @keyHash[key]
13
+ end
14
+
15
+ def set( key, value )
16
+ @keyHash[key] = value
17
+ end
18
+
19
+ def sadd( key, value )
20
+ if @keyHash[key].nil? then
21
+ @keyHash[key] = Array.new
22
+ end
23
+ @keyHash[key] << value
24
+ end
25
+
26
+ def smembers( key )
27
+ return @keyHash[key]
28
+ end
29
+ end
30
+
31
+ end
@@ -13,4 +13,4 @@ module RServiceBus
13
13
  return hash.to_json
14
14
  end
15
15
 
16
- end
16
+ 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
4
+ version: 0.0.5
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-06-14 00:00:00.000000000 Z
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: A ruby implementation of NServiceBus
15
15
  email: guy@guyirvine.com
@@ -29,6 +29,9 @@ files:
29
29
  - lib/rservicebus/Message.rb
30
30
  - lib/rservicebus/RedisAppResource.rb
31
31
  - lib/rservicebus/Subscription.rb
32
+ - lib/rservicebus/Test/Bus.rb
33
+ - lib/rservicebus/Test/Redis.rb
34
+ - lib/rservicebus/Test.rb
32
35
  - lib/rservicebus.rb
33
36
  - bin/rservicebus
34
37
  - LICENSE