rservicebus 0.1.74 → 0.1.75

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.
Files changed (66) hide show
  1. data/bin/ReturnMessagesToSourceQueue +18 -18
  2. data/bin/SendEmptyMessage +3 -3
  3. data/bin/rsb_ctl +10 -10
  4. data/bin/rservicebus-create +4 -4
  5. data/bin/rservicebus-init +7 -6
  6. data/lib/rservicebus.rb +49 -49
  7. data/lib/rservicebus/Agent.rb +4 -4
  8. data/lib/rservicebus/AppResource.rb +4 -4
  9. data/lib/rservicebus/AppResource/Dir.rb +3 -3
  10. data/lib/rservicebus/AppResource/FluidDb.rb +1 -1
  11. data/lib/rservicebus/AppResource/FluidDbFirebird.rb +1 -1
  12. data/lib/rservicebus/AppResource/FluidDbMysql.rb +4 -4
  13. data/lib/rservicebus/AppResource/FluidDbMysql2.rb +4 -4
  14. data/lib/rservicebus/AppResource/FluidDbPgsql.rb +4 -4
  15. data/lib/rservicebus/AppResource/FluidDbTinyTds.rb +1 -1
  16. data/lib/rservicebus/AppResource/Mysql.rb +2 -2
  17. data/lib/rservicebus/AppResource/Redis.rb +1 -1
  18. data/lib/rservicebus/AppResource/ScpDownload.rb +51 -0
  19. data/lib/rservicebus/AppResource/ScpUpload.rb +3 -2
  20. data/lib/rservicebus/AppResource/Smb.rb +3 -3
  21. data/lib/rservicebus/AppResource/SmbDir.rb +2 -2
  22. data/lib/rservicebus/AppResource/SmbFile.rb +1 -1
  23. data/lib/rservicebus/Audit.rb +9 -9
  24. data/lib/rservicebus/CircuitBreaker.rb +4 -4
  25. data/lib/rservicebus/Config.rb +46 -46
  26. data/lib/rservicebus/ConfigureAppResource.rb +64 -63
  27. data/lib/rservicebus/ConfigureMonitor.rb +12 -12
  28. data/lib/rservicebus/ConfigureSubscriptionStorage.rb +5 -5
  29. data/lib/rservicebus/CronManager.rb +8 -8
  30. data/lib/rservicebus/EndpointMapping.rb +11 -11
  31. data/lib/rservicebus/HandlerLoader.rb +33 -33
  32. data/lib/rservicebus/HandlerManager.rb +2 -2
  33. data/lib/rservicebus/Host.rb +58 -58
  34. data/lib/rservicebus/MQ.rb +21 -21
  35. data/lib/rservicebus/MQ/Beanstalk.rb +9 -9
  36. data/lib/rservicebus/MQ/RabbitMq.rb +5 -5
  37. data/lib/rservicebus/MQ/Redis.rb +3 -3
  38. data/lib/rservicebus/Message.rb +11 -11
  39. data/lib/rservicebus/Monitor.rb +5 -5
  40. data/lib/rservicebus/Monitor/CsvDir.rb +5 -5
  41. data/lib/rservicebus/Monitor/CsvPerLine.rb +5 -5
  42. data/lib/rservicebus/Monitor/Dir.rb +34 -34
  43. data/lib/rservicebus/Monitor/DirNotifier.rb +15 -15
  44. data/lib/rservicebus/ResourceManager.rb +2 -2
  45. data/lib/rservicebus/Saga/Manager.rb +18 -18
  46. data/lib/rservicebus/SagaLoader.rb +19 -19
  47. data/lib/rservicebus/SagaStorage.rb +4 -4
  48. data/lib/rservicebus/SagaStorage/Dir.rb +12 -12
  49. data/lib/rservicebus/SendAtManager.rb +4 -4
  50. data/lib/rservicebus/SendAtStorage.rb +5 -5
  51. data/lib/rservicebus/SendAtStorage/File.rb +3 -3
  52. data/lib/rservicebus/StateManager.rb +2 -2
  53. data/lib/rservicebus/StateStorage.rb +2 -2
  54. data/lib/rservicebus/StateStorage/Dir.rb +11 -11
  55. data/lib/rservicebus/StateStorage/InMemory.rb +1 -1
  56. data/lib/rservicebus/StatisticManager.rb +2 -2
  57. data/lib/rservicebus/SubscriptionManager.rb +2 -2
  58. data/lib/rservicebus/SubscriptionStorage.rb +4 -4
  59. data/lib/rservicebus/SubscriptionStorage/File.rb +3 -3
  60. data/lib/rservicebus/SubscriptionStorage/Redis.rb +10 -10
  61. data/lib/rservicebus/Test.rb +2 -2
  62. data/lib/rservicebus/Test/Bus.rb +2 -2
  63. data/lib/rservicebus/Test/Redis.rb +1 -1
  64. data/lib/rservicebus/Transporter.rb +15 -15
  65. data/lib/rservicebus/helper_functions.rb +15 -15
  66. metadata +13 -12
@@ -1,6 +1,6 @@
1
1
  module RServiceBus
2
2
 
3
- require "uri"
3
+ require 'uri'
4
4
 
5
5
  # Base class for subscription storage
6
6
  #
@@ -22,7 +22,7 @@ class SubscriptionStorage
22
22
  # @param [String] appName Name of the application, which is used as a Namespace
23
23
  # @param [String] uri a location for the resource to which we will attach, eg redis://127.0.0.1/foo
24
24
  def getAll
25
- raise "Method, getResource, needs to be implemented for resource"
25
+ raise 'Method, getResource, needs to be implemented for resource'
26
26
  end
27
27
 
28
28
  # Add a new subscription
@@ -30,7 +30,7 @@ class SubscriptionStorage
30
30
  # @param [String] eventName Name of the event for which the subscriber has asked for notification
31
31
  # @param [String] queueName the queue to which the event should be sent
32
32
  def add( eventName, queueName )
33
- raise "Method, add, needs to be implemented for this subscription storage"
33
+ raise 'Method, add, needs to be implemented for this subscription storage'
34
34
  end
35
35
 
36
36
  # Remove an existing subscription
@@ -38,7 +38,7 @@ class SubscriptionStorage
38
38
  # @param [String] eventName Name of the event for which the subscriber has asked for notification
39
39
  # @param [String] queueName the queue to which the event should be sent
40
40
  def remove( eventName, queueName )
41
- raise "Method, remove, needs to be implemented for this subscription storage"
41
+ raise 'Method, remove, needs to be implemented for this subscription storage'
42
42
  end
43
43
  end
44
44
 
@@ -14,7 +14,7 @@ class SubscriptionStorage_File<SubscriptionStorage
14
14
  end
15
15
 
16
16
  def getAll
17
- RServiceBus.log "Load subscriptions"
17
+ RServiceBus.log 'Load subscriptions'
18
18
  return Hash.new unless File.exists?( @uri.path )
19
19
 
20
20
  return YAML::load( File.open( @uri.path ) )
@@ -32,13 +32,13 @@ class SubscriptionStorage_File<SubscriptionStorage
32
32
  subscriptions[eventName] << queueName
33
33
  subscriptions[eventName] = subscriptions[eventName].uniq
34
34
 
35
- File.open( @uri.path, "w" ) { |f| f.write( YAML::dump(subscriptions ) ) }
35
+ File.open( @uri.path, 'w') { |f| f.write( YAML::dump(subscriptions ) ) }
36
36
 
37
37
  return subscriptions
38
38
  end
39
39
 
40
40
  def remove( eventName, queueName )
41
- raise "Method, remove, needs to be implemented for this subscription storage"
41
+ raise 'Method, remove, needs to be implemented for this subscription storage'
42
42
  end
43
43
 
44
44
  end
@@ -1,6 +1,6 @@
1
1
  module RServiceBus
2
2
 
3
- require "redis"
3
+ require 'redis'
4
4
 
5
5
  #Implementation of Subscription Storage to Redis
6
6
  class SubscriptionStorage_Redis<SubscriptionStorage
@@ -18,9 +18,9 @@ class SubscriptionStorage_Redis<SubscriptionStorage
18
18
  end
19
19
 
20
20
  def getAll
21
- RServiceBus.log "Load subscriptions"
21
+ RServiceBus.log 'Load subscriptions'
22
22
  begin
23
- content = @redis.get( @appName + ".Subscriptions" )
23
+ content = @redis.get( @appName + '.Subscriptions')
24
24
  if content.nil? then
25
25
  subscriptions = Hash.new
26
26
  else
@@ -28,10 +28,10 @@ class SubscriptionStorage_Redis<SubscriptionStorage
28
28
  end
29
29
  return subscriptions
30
30
  rescue Exception => e
31
- puts "Error connecting to redis"
32
- if e.message == "Redis::CannotConnectError" ||
33
- e.message == "Redis::ECONNREFUSED" then
34
- puts "***Most likely, redis is not running. Start redis, and try running this again."
31
+ puts 'Error connecting to redis'
32
+ if e.message == 'Redis::CannotConnectError' ||
33
+ e.message == 'Redis::ECONNREFUSED' then
34
+ puts '***Most likely, redis is not running. Start redis, and try running this again.'
35
35
  else
36
36
  puts e.message
37
37
  puts e.backtrace
@@ -41,7 +41,7 @@ class SubscriptionStorage_Redis<SubscriptionStorage
41
41
  end
42
42
 
43
43
  def add( eventName, queueName )
44
- content = @redis.get( @appName + ".Subscriptions" )
44
+ content = @redis.get( @appName + '.Subscriptions')
45
45
  if content.nil? then
46
46
  subscriptions = Hash.new
47
47
  else
@@ -55,13 +55,13 @@ class SubscriptionStorage_Redis<SubscriptionStorage
55
55
  subscriptions[eventName] << queueName
56
56
  subscriptions[eventName] = subscriptions[eventName].uniq
57
57
 
58
- @redis.set( @appName + ".Subscriptions", YAML::dump(subscriptions ) )
58
+ @redis.set( @appName + '.Subscriptions', YAML::dump(subscriptions ) )
59
59
 
60
60
  return subscriptions
61
61
  end
62
62
 
63
63
  def remove( eventName, queueName )
64
- raise "Method, remove, needs to be implemented for this subscription storage"
64
+ raise 'Method, remove, needs to be implemented for this subscription storage'
65
65
  end
66
66
 
67
67
  end
@@ -1,3 +1,3 @@
1
- require "rservicebus/Test/Bus"
2
- require "rservicebus/Test/Redis"
1
+ require 'rservicebus/Test/Bus'
2
+ require 'rservicebus/Test/Redis'
3
3
 
@@ -30,8 +30,8 @@ class Test_Bus
30
30
 
31
31
  def log( string, verbose=false )
32
32
  item = Hash.new
33
- item["string"] = string
34
- item["verbose"] = verbose
33
+ item['string'] = string
34
+ item['verbose'] = verbose
35
35
  @logList << item
36
36
  end
37
37
  end
@@ -48,7 +48,7 @@ module RServiceBus
48
48
  end
49
49
 
50
50
  def incr( key )
51
- @keyHash[key] = 0 if !@keyHash.has_key?( key )
51
+ @keyHash[key] = 0 unless @keyHash.has_key?(key)
52
52
 
53
53
  @keyHash[key] = @keyHash[key] + 1
54
54
  return @keyHash[key]
@@ -15,24 +15,24 @@ module RServiceBus
15
15
  class Transporter
16
16
 
17
17
  def getValue( name, default=nil )
18
- value = ( ENV[name].nil? || ENV[name] == "" ) ? default : ENV[name];
18
+ value = ( ENV[name].nil? || ENV[name] == '') ? default : ENV[name];
19
19
  RServiceBus.log "Env value: #{name}: #{value}"
20
20
  return value
21
21
  end
22
22
 
23
23
  def connectToSourceBeanstalk
24
- sourceQueueName = getValue( 'SOURCE_QUEUE_NAME', "transport-out" )
25
- sourceUrl = getValue( 'SOURCE_URL', "127.0.0.1:11300" )
24
+ sourceQueueName = getValue( 'SOURCE_QUEUE_NAME', 'transport-out')
25
+ sourceUrl = getValue( 'SOURCE_URL', '127.0.0.1:11300')
26
26
  @source = Beanstalk::Pool.new([sourceUrl])
27
27
  @source.watch sourceQueueName
28
28
 
29
29
  RServiceBus.log "Connected to, #{sourceQueueName}@#{sourceUrl}"
30
30
 
31
31
  rescue Exception => e
32
- puts "Error connecting to Beanstalk"
32
+ puts 'Error connecting to Beanstalk'
33
33
  puts "Host string, #{sourceUrl}"
34
- if e.message == "Beanstalk::NotConnected" then
35
- puts "***Most likely, beanstalk is not running. Start beanstalk, and try running this again."
34
+ if e.message == 'Beanstalk::NotConnected' then
35
+ puts '***Most likely, beanstalk is not running. Start beanstalk, and try running this again.'
36
36
  puts "***If you still get this error, check beanstalk is running at, #{sourceUrl}"
37
37
  else
38
38
  puts e.message
@@ -72,7 +72,7 @@ module RServiceBus
72
72
  abort()
73
73
  end
74
74
 
75
- @localPort = getValue( "LOCAL_PORT", 27018 ).to_i
75
+ @localPort = getValue( 'LOCAL_PORT', 27018 ).to_i
76
76
  RServiceBus.rlog "Local Port: #{@localPort}"
77
77
 
78
78
  begin
@@ -88,7 +88,7 @@ module RServiceBus
88
88
  abort()
89
89
  rescue Errno::EACCES => e
90
90
  puts "*** Local transport port specified, #{@localPort}, needs sudo access"
91
- puts "*** Change local transport port using format, LOCAL_PORT=27018"
91
+ puts '*** Change local transport port using format, LOCAL_PORT=27018'
92
92
  abort()
93
93
 
94
94
  end
@@ -99,7 +99,7 @@ module RServiceBus
99
99
  @destination = Beanstalk::Pool.new([destinationUrl])
100
100
  RServiceBus.rlog "Connected to Remote Beanstalk, #{destinationUrl}"
101
101
  rescue Exception => e
102
- if e.message == "Beanstalk::NotConnected" then
102
+ if e.message == 'Beanstalk::NotConnected' then
103
103
  puts "***Could not connect to destination, check beanstalk is running at, #{destinationUrl}"
104
104
  raise CouldNotConnectToDestination.new
105
105
  end
@@ -120,10 +120,10 @@ module RServiceBus
120
120
  @destination.use( msg.remoteQueueName )
121
121
  @destination.put( job.body )
122
122
  RServiceBus.log "Msg put, #{msg.remoteQueueName}"
123
-
124
- if !ENV['AUDIT_QUEUE_NAME'].nil? then
125
- @source.use ENV['AUDIT_QUEUE_NAME']
126
- @source.put job.body
123
+
124
+ unless ENV['AUDIT_QUEUE_NAME'].nil? then
125
+ @source.use ENV['AUDIT_QUEUE_NAME']
126
+ @source.put job.body
127
127
  end
128
128
  #removeJob
129
129
  job.delete
@@ -133,8 +133,8 @@ module RServiceBus
133
133
 
134
134
  rescue Exception => e
135
135
  self.disconnect
136
- if e.message == "TIMED_OUT" then
137
- RServiceBus.rlog "No Msg"
136
+ if e.message == 'TIMED_OUT' then
137
+ RServiceBus.rlog 'No Msg'
138
138
  return
139
139
  end
140
140
  raise e
@@ -3,7 +3,7 @@ module RServiceBus
3
3
 
4
4
  def RServiceBus.convertDTOToHash( obj )
5
5
  hash = {};
6
- obj.instance_variables.each {|var| hash[var.to_s.delete("@")] = obj.instance_variable_get(var) }
6
+ obj.instance_variables.each {|var| hash[var.to_s.delete('@')] = obj.instance_variable_get(var) }
7
7
 
8
8
  return hash
9
9
  end
@@ -15,18 +15,18 @@ module RServiceBus
15
15
  end
16
16
 
17
17
  def RServiceBus.log(string, ver=false)
18
- return if RServiceBus.checkEnvironmentVariable("TESTING")
18
+ return if RServiceBus.checkEnvironmentVariable('TESTING')
19
19
 
20
- type = ver ? "VERB" : "INFO"
21
- if RServiceBus.checkEnvironmentVariable("VERBOSE") || !ver then
22
- timestamp = Time.new.strftime( "%Y-%m-%d %H:%M:%S" )
20
+ type = ver ? 'VERB' : 'INFO'
21
+ if RServiceBus.checkEnvironmentVariable('VERBOSE') || !ver then
22
+ timestamp = Time.new.strftime('%Y-%m-%d %H:%M:%S')
23
23
  puts "[#{type}] #{timestamp} :: #{string}"
24
24
  end
25
25
  end
26
26
 
27
27
  def RServiceBus.rlog(string)
28
- if RServiceBus.checkEnvironmentVariable("RSBVERBOSE") then
29
- timestamp = Time.new.strftime( "%Y-%m-%d %H:%M:%S" )
28
+ if RServiceBus.checkEnvironmentVariable('RSBVERBOSE') then
29
+ timestamp = Time.new.strftime('%Y-%m-%d %H:%M:%S')
30
30
  puts "[RSB] #{timestamp} :: #{string}"
31
31
  end
32
32
  end
@@ -38,18 +38,18 @@ module RServiceBus
38
38
  end
39
39
 
40
40
  def RServiceBus.getValue( name, default=nil )
41
- value = ( ENV[name].nil? || ENV[name] == "" ) ? default : ENV[name];
41
+ value = ( ENV[name].nil? || ENV[name] == '') ? default : ENV[name];
42
42
  log "Env value: #{name}: #{value}"
43
43
  return value
44
44
  end
45
45
 
46
- def RServiceBus.sendMsg( msg, responseQueue="agent" )
47
- require "rservicebus/EndpointMapping"
46
+ def RServiceBus.sendMsg( msg, responseQueue='agent')
47
+ require 'rservicebus/EndpointMapping'
48
48
  endpointMapping = EndpointMapping.new
49
49
  endpointMapping.Configure
50
50
  queueName = endpointMapping.get( msg.class.name )
51
51
 
52
- ENV["RSBMQ"] = "beanstalk://localhost" if ENV["RSBMQ"].nil?
52
+ ENV['RSBMQ'] = 'beanstalk://localhost' if ENV['RSBMQ'].nil?
53
53
  agent = RServiceBus::Agent.new
54
54
  Audit.new( agent ).audit( msg )
55
55
  agent.sendMsg(msg, queueName, responseQueue)
@@ -62,13 +62,13 @@ module RServiceBus
62
62
  raise StandardError.new( msg )
63
63
  end
64
64
 
65
- def RServiceBus.sendMsg( msg, responseQueue="agent" )
66
- require "rservicebus/EndpointMapping"
65
+ def RServiceBus.sendMsg( msg, responseQueue='agent')
66
+ require 'rservicebus/EndpointMapping'
67
67
  endpointMapping = EndpointMapping.new
68
68
  endpointMapping.Configure
69
69
  queueName = endpointMapping.get( msg.class.name )
70
70
 
71
- ENV["RSBMQ"] = "beanstalk://localhost" if ENV["RSBMQ"].nil?
71
+ ENV['RSBMQ'] = 'beanstalk://localhost' if ENV['RSBMQ'].nil?
72
72
  agent = RServiceBus::Agent.new
73
73
  Audit.new( agent ).auditOutgoing( msg )
74
74
  agent.sendMsg(msg, queueName, responseQueue)
@@ -82,7 +82,7 @@ module RServiceBus
82
82
  end
83
83
 
84
84
  def RServiceBus.checkForReply( queueName )
85
- ENV["RSBMQ"] = "beanstalk://localhost" if ENV["RSBMQ"].nil?
85
+ ENV['RSBMQ'] = 'beanstalk://localhost' if ENV['RSBMQ'].nil?
86
86
  agent = RServiceBus::Agent.new
87
87
  msg = agent.checkForReply( queueName )
88
88
  Audit.new( agent ).auditIncoming( msg )
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.74
4
+ version: 0.1.75
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-08-13 00:00:00.000000000 Z
12
+ date: 2014-09-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: uuidtools
16
- requirement: &70137776893800 !ruby/object:Gem::Requirement
16
+ requirement: &70221541858240 !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: *70137776893800
24
+ version_requirements: *70221541858240
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: json
27
- requirement: &70137776898900 !ruby/object:Gem::Requirement
27
+ requirement: &70221541775440 !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: *70137776898900
35
+ version_requirements: *70221541775440
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: beanstalk-client
38
- requirement: &70137776943820 !ruby/object:Gem::Requirement
38
+ requirement: &70221541772040 !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: *70137776943820
46
+ version_requirements: *70221541772040
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: fluiddb
49
- requirement: &70137776941020 !ruby/object:Gem::Requirement
49
+ requirement: &70221541770320 !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: *70137776941020
57
+ version_requirements: *70221541770320
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: parse-cron
60
- requirement: &70137776947260 !ruby/object:Gem::Requirement
60
+ requirement: &70221541285600 !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: *70137776947260
68
+ version_requirements: *70221541285600
69
69
  description: A Ruby interpretation of NServiceBus
70
70
  email: guy@guyirvine.com
71
71
  executables:
@@ -89,6 +89,7 @@ files:
89
89
  - lib/rservicebus/AppResource/FluidDbTinyTds.rb
90
90
  - lib/rservicebus/AppResource/Mysql.rb
91
91
  - lib/rservicebus/AppResource/Redis.rb
92
+ - lib/rservicebus/AppResource/ScpDownload.rb
92
93
  - lib/rservicebus/AppResource/ScpUpload.rb
93
94
  - lib/rservicebus/AppResource/Smb.rb
94
95
  - lib/rservicebus/AppResource/SmbDir.rb