rservicebus2 0.0.3 → 0.0.4

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4263471148f747aa3b457b906c57ec1db20d229b
4
- data.tar.gz: 40d77269e8ed10bc478319443773beabfa2aac1d
3
+ metadata.gz: 8cefcebe817e07916ac889a97b5fe82fa755a68a
4
+ data.tar.gz: a6842886a0c4da7caceb7792d43c146f63011831
5
5
  SHA512:
6
- metadata.gz: 3695eda330c3692bdeb9c1832887407d98b82690866f272d430de46e2b145919e9bb48e48fad26c3dd3c3743f6222f48e806d6fc8f6059059cc04036e173ef96
7
- data.tar.gz: adf53536976e6c77bca157312a5408b4728c1f67c77a654de55674ec1916587288619794277bc40c3f909e2b3a50bbcf6f26f5d77ddec6a42c53fb65dcc1f2c3
6
+ metadata.gz: 23308f1c27bd7c8b382078320bbcbc5f72b33eaa3733f78200d270156c3527bb805b5c8127ad4f02bcfb02a1140af7bbefaf879be8b1f1078cbb2421a6cbc3e9
7
+ data.tar.gz: 818be84dbdb8d68244a00c3dbff927cff6b603461e92d5474d96655e1621681d4322b8cc32754f392766325d76bd4956ea6b764f054739efb7fb163459f5343b
@@ -55,5 +55,5 @@ require 'rservicebus2/saga_storage'
55
55
  require 'rservicebus2/sendat_manager'
56
56
 
57
57
  # Initial definition of the namespace
58
- module RServiceBus
58
+ module RServiceBus2
59
59
  end
@@ -25,7 +25,7 @@ module RServiceBus2
25
25
  def send_msg(message_obj, queue_name, return_address = nil)
26
26
  fail QueueNotFoundForMsg, message_obj.class.name if queue_name.nil?
27
27
 
28
- msg = RServiceBus::Message.new(message_obj, return_address)
28
+ msg = RServiceBus2::Message.new(message_obj, return_address)
29
29
  if queue_name.index('@').nil?
30
30
  q = queue_name
31
31
  else
@@ -3,10 +3,10 @@ module RServiceBus2
3
3
  class Audit
4
4
  def initialize(mq)
5
5
  @mq = mq
6
- audit_queue_name = RServiceBus.get_value('AUDIT_QUEUE_NAME')
6
+ audit_queue_name = RServiceBus2.get_value('AUDIT_QUEUE_NAME')
7
7
  if audit_queue_name.nil?
8
- @sent_messages_to = RServiceBus.get_value('sent_messages_to')
9
- @received_messages_to = RServiceBus.get_value('received_messages_to')
8
+ @sent_messages_to = RServiceBus2.get_value('sent_messages_to')
9
+ @received_messages_to = RServiceBus2.get_value('received_messages_to')
10
10
  else
11
11
  @sent_messages_to = audit_queue_name
12
12
  @received_messages_to = audit_queue_name
@@ -28,7 +28,7 @@ module RServiceBus2
28
28
  # Note. trailing slashs will be stripped
29
29
  # Expected format: <path 1>;<path 2>
30
30
  def load_handler_path_list
31
- paths = get_value('MSGHANDLERPATH', './MessageHandler')
31
+ paths = get_value('MSGHANDLERPATH', './messagehandler')
32
32
  @handler_path_list = []
33
33
  paths.split(';').each do |path|
34
34
  @handler_path_list << path.strip.chomp('/')
@@ -48,7 +48,7 @@ module RServiceBus2
48
48
  end
49
49
 
50
50
  def load_host_section
51
- @app_name = get_value('APPNAME', 'RServiceBus')
51
+ @app_name = get_value('APPNAME', 'RServiceBus2')
52
52
  @error_queue_name = get_value('ERROR_QUEUE_NAME', 'error')
53
53
  @max_retries = get_value('MAX_RETRIES', '5').to_i
54
54
  @stat_output_countdown = get_value('STAT_OUTPUT_COUNTDOWN', '100').to_i
@@ -82,7 +82,7 @@ module RServiceBus2
82
82
 
83
83
  # Marshals paths for contracts
84
84
  # Note. .rb extension is optional
85
- # Expected format: /one/two/Contracts
85
+ # Expected format: /one/two/contracts
86
86
  def load_contracts
87
87
  @contract_list = []
88
88
  # This is a guard clause in case no Contracts have been specified
@@ -90,7 +90,7 @@ module RServiceBus2
90
90
  # to the second block
91
91
  return self if get_value('CONTRACTS').nil?
92
92
 
93
- get_value('CONTRACTS', './Contract').split(';').each do |path|
93
+ get_value('CONTRACTS', './contract').split(';').each do |path|
94
94
  ensure_contract_file_exists(path)
95
95
  @contract_list << path
96
96
  end
@@ -99,7 +99,7 @@ module RServiceBus2
99
99
 
100
100
  # Marshals paths for lib
101
101
  # Note. .rb extension is optional
102
- # Expected format: /one/two/Contracts
102
+ # Expected format: /one/two/contracts
103
103
  def load_libs
104
104
  @lib_list = []
105
105
 
@@ -143,9 +143,9 @@ module RServiceBus2
143
143
  puts "*** path, #{path}, does not exist"
144
144
  abort
145
145
  end
146
- @handler_path_list << "#{path}/MessageHandler" if Dir.exist?("#{path}/MessageHandler")
147
- @saga_path_list << "#{path}/Saga" if Dir.exist?("#{path}/Saga")
148
- @contract_list << "#{path}/Contract.rb" if File.exist?( "#{path}/Contract.rb" )
146
+ @handler_path_list << "#{path}/messagehandler" if Dir.exist?("#{path}/messagehandler")
147
+ @saga_path_list << "#{path}/saga" if Dir.exist?("#{path}/saga")
148
+ @contract_list << "#{path}/contract.rb" if File.exist?( "#{path}/contract.rb" )
149
149
  @lib_list << "#{path}/lib" if File.exist?("#{path}/lib")
150
150
  end
151
151
  self
@@ -8,7 +8,7 @@ module RServiceBus2
8
8
 
9
9
  # Constructor
10
10
  #
11
- # @param [RServiceBus::Host] host instance
11
+ # @param [RServiceBus2::Host] host instance
12
12
  # @param [Hash] appResources As hash[k,v] where k is the name of a
13
13
  # resource, and v is the resource
14
14
  def initialize(host, handler_manager)
@@ -26,7 +26,7 @@ module RServiceBus2
26
26
 
27
27
  return file_path.sub('.rb', '') if File.exist?(file_path)
28
28
 
29
- abort('Filepath, ' + file_path + ", given for MessageHandler require
29
+ abort('Filepath, ' + file_path + ", given for messagehandler require
30
30
  doesn't exist")
31
31
  end
32
32
 
@@ -37,7 +37,7 @@ module RServiceBus2
37
37
  # or configuration corrected.
38
38
  # @param [String] handler_name name of the handler to instantiate
39
39
  # @param [String] file_path the path to the file to be loaded
40
- # @return [RServiceBus::Handler] the loader
40
+ # @return [RServiceBus2::Handler] the loader
41
41
  def load_handler_from_file(handler_name, file_path)
42
42
  require_path = get_require_path(file_path)
43
43
 
@@ -60,19 +60,19 @@ module RServiceBus2
60
60
  #
61
61
  # @param [String] file_path
62
62
  # @param [String] handler_name
63
- # @returns [RServiceBus::Handler] handler
63
+ # @returns [RServiceBus2::Handler] handler
64
64
  def load_handler(msg_name, file_path, handler_name)
65
65
  if @list_of_loaded_paths.key?(file_path)
66
- RServiceBus.log "Not reloading, #{file_path}"
66
+ RServiceBus2.log "Not reloading, #{file_path}"
67
67
  return
68
68
  end
69
69
 
70
70
  begin
71
- RServiceBus.rlog 'file_path: ' + file_path
72
- RServiceBus.rlog 'handler_name: ' + handler_name
71
+ RServiceBus2.rlog 'file_path: ' + file_path
72
+ RServiceBus2.rlog 'handler_name: ' + handler_name
73
73
 
74
74
  handler = load_handler_from_file(handler_name, file_path)
75
- RServiceBus.log 'Loaded Handler: ' + handler_name
75
+ RServiceBus2.log 'Loaded Handler: ' + handler_name
76
76
 
77
77
  @handler_manager.add_handler(msg_name, handler)
78
78
 
@@ -91,7 +91,7 @@ module RServiceBus2
91
91
  # @return [Array] a list of paths to files found in the given path
92
92
  def get_list_of_files_for_dir(path)
93
93
  list = Dir[path + '/*']
94
- RServiceBus.rlog "HandlerLoader.getListOfFilesForDir. path: #{path},
94
+ RServiceBus2.rlog "HandlerLoader.getListOfFilesForDir. path: #{path},
95
95
  list: #{list}"
96
96
  list
97
97
  end
@@ -109,7 +109,7 @@ module RServiceBus2
109
109
  ext_name = File.extname(file_path)
110
110
  if !File.directory?(file_path) && ext_name == '.rb'
111
111
  file_name = File.basename(file_path).sub('.rb', '')
112
- handler_name = "MessageHandler_#{msg_name}_#{file_name}"
112
+ handler_name = "message_handler_#{msg_name}_#{file_name}".gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1') # Classify
113
113
 
114
114
  load_handler(msg_name, file_path, handler_name)
115
115
  end
@@ -124,23 +124,21 @@ module RServiceBus2
124
124
  def get_msg_name(file_path)
125
125
  base_name = File.basename(file_path)
126
126
  ext_name = File.extname(base_name)
127
- file_name = base_name.sub(ext_name, '')
128
-
129
- msg_name = file_name
127
+ base_name.sub(ext_name, '')
130
128
  end
131
129
 
132
130
  # Load top level handlers from the given directory
133
131
  #
134
132
  # @param [String] baseDir directory to check - should not have trailing slash
135
133
  def load_handlers_from_top_level_path(base_dir)
136
- RServiceBus.rlog "HandlerLoader.loadHandlersFromTopLevelPath. baseDir: #{base_dir}"
134
+ RServiceBus2.rlog "HandlerLoader.loadHandlersFromTopLevelPath. baseDir: #{base_dir}"
137
135
  get_list_of_files_for_dir(base_dir).each do |file_path|
138
136
  unless file_path.end_with?('.')
139
137
  msg_name = get_msg_name(file_path)
140
138
  if File.directory?(file_path)
141
139
  load_handlers_from_second_level_path(msg_name, file_path)
142
140
  else
143
- handler_name = "MessageHandler_#{msg_name}"
141
+ handler_name = "message_handler_#{msg_name}".gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1') # Classify
144
142
  load_handler(msg_name, file_path, handler_name)
145
143
  end
146
144
  end
@@ -6,7 +6,7 @@ module RServiceBus2
6
6
  class HandlerManager
7
7
  # Constructor
8
8
  #
9
- # @param [RServiceBus::Host] host instance
9
+ # @param [RServiceBus2::Host] host instance
10
10
  # @param [Hash] app_resources As hash[k,v] where k is the name of a resource, and v is the resource
11
11
  def initialize(host, resource_manager, state_manager)
12
12
  @host = host
@@ -19,11 +19,11 @@ module RServiceBus2
19
19
 
20
20
  # setBusAttributeIfRequested
21
21
  #
22
- # @param [RServiceBus::Handler] handler
22
+ # @param [RServiceBus2::Handler] handler
23
23
  def set_bus_attribute_if_requested(handler)
24
24
  if defined?(handler.bus)
25
25
  handler.bus = @host
26
- RServiceBus.log 'Bus attribute set for: ' + handler.class.name
26
+ RServiceBus2.log 'Bus attribute set for: ' + handler.class.name
27
27
  end
28
28
 
29
29
  self
@@ -31,11 +31,11 @@ module RServiceBus2
31
31
 
32
32
  # setStateAttributeIfRequested
33
33
  #
34
- # @param [RServiceBus::Handler] handler
34
+ # @param [RServiceBus2::Handler] handler
35
35
  def set_state_attribute_if_requested(handler)
36
36
  if defined?(handler.State)
37
37
  handler.State = @state_manager.get(handler)
38
- RServiceBus.log 'Bus attribute set for: ' + handler.class.name
38
+ RServiceBus2.log 'Bus attribute set for: ' + handler.class.name
39
39
  end
40
40
 
41
41
  self
@@ -43,7 +43,7 @@ module RServiceBus2
43
43
 
44
44
  # checkIfStateAttributeRequested
45
45
  #
46
- # @param [RServiceBus::Handler] handler
46
+ # @param [RServiceBus2::Handler] handler
47
47
  def check_if_state_attribute_requested(handler)
48
48
  @state_manager.Required if defined?(handler.state)
49
49
 
@@ -51,15 +51,15 @@ module RServiceBus2
51
51
  end
52
52
 
53
53
  def interrogate_handler_for_app_resources(handler)
54
- RServiceBus.rlog "Checking app resources for: #{handler.class.name}"
55
- RServiceBus.rlog "If your attribute is not getting set, check that it is in the 'attr_accessor' list"
54
+ RServiceBus2.rlog "Checking app resources for: #{handler.class.name}"
55
+ RServiceBus2.rlog "If your attribute is not getting set, check that it is in the 'attr_accessor' list"
56
56
 
57
57
  @resource_list_by_handler_name[handler.class.name] = []
58
58
  @resource_manager.get_all.each do |k, v|
59
59
  next unless handler.class.method_defined?(k)
60
60
 
61
61
  @resource_list_by_handler_name[handler.class.name] << k
62
- RServiceBus.log "Resource attribute, #{k}, found for: " +
62
+ RServiceBus2.log "Resource attribute, #{k}, found for: " +
63
63
  handler.class.name
64
64
  end
65
65
 
@@ -97,7 +97,7 @@ module RServiceBus2
97
97
  next if @resource_list_by_handler_name[handler.class.name].nil?
98
98
  @resource_list_by_handler_name[handler.class.name].each do |k|
99
99
  handler.instance_variable_set("@#{k}", @resource_manager.get(k).get_resource)
100
- RServiceBus.rlog "App resource attribute, #{k}, set for: " + handler.class.name
100
+ RServiceBus2.rlog "App resource attribute, #{k}, set for: " + handler.class.name
101
101
  end
102
102
  end
103
103
  end
@@ -43,7 +43,7 @@ module RServiceBus2
43
43
 
44
44
  # Thin veneer for Configuring state
45
45
  def configure_saga_storage
46
- string = RServiceBus.get_value('SAGA_URI')
46
+ string = RServiceBus2.get_value('SAGA_URI')
47
47
  string = 'dir:///tmp' if string.nil?
48
48
 
49
49
  uri = URI.parse(string)
@@ -119,7 +119,7 @@ module RServiceBus2
119
119
 
120
120
  @config.contract_list.each do |path|
121
121
  require path
122
- RServiceBus.rlog "Loaded Contract: #{path}"
122
+ RServiceBus2.rlog "Loaded Contract: #{path}"
123
123
  end
124
124
 
125
125
  self
@@ -216,19 +216,19 @@ module RServiceBus2
216
216
  @stats.inc_total_processed
217
217
  @msg = YAML.load(body)
218
218
  case @msg.msg.class.name
219
- when 'RServiceBus::MessageSubscription'
219
+ when 'RServiceBus2::MessageSubscription'
220
220
  @subscription_manager.add(@msg.msg.event_name,
221
221
  @msg.return_address)
222
- when 'RServiceBus::MessageStatisticOutputOn'
222
+ when 'RServiceBus2::MessageStatisticOutputOn'
223
223
  @stats.output = true
224
224
  log 'Turn on Stats logging'
225
- when 'RServiceBus::MessageStatisticOutputOff'
225
+ when 'RServiceBus2::MessageStatisticOutputOff'
226
226
  @stats.output = false
227
227
  log 'Turn off Stats logging'
228
- when 'RServiceBus::MessageVerboseOutputOn'
228
+ when 'RServiceBus2::MessageVerboseOutputOn'
229
229
  ENV['VERBOSE'] = 'true'
230
230
  log 'Turn on Verbose logging'
231
- when 'RServiceBus::MessageVerboseOutputOff'
231
+ when 'RServiceBus2::MessageVerboseOutputOff'
232
232
  ENV.delete('VERBOSE')
233
233
  log 'Turn off Verbose logging'
234
234
  else
@@ -240,7 +240,7 @@ module RServiceBus2
240
240
  @mq.ack
241
241
  rescue ClassNotFoundForMsg => e
242
242
  puts "*** Class not found for msg, #{e.message}"
243
- puts "*** Ensure, #{e.message}, is defined in Contract.rb, most
243
+ puts "*** Ensure, #{e.message}, is defined in contract.rb, most
244
244
  likely as 'Class #{e.message} end"
245
245
 
246
246
  @msg.add_error_msg(@mq.local_queue_name, e.message)
@@ -251,7 +251,7 @@ module RServiceBus2
251
251
  rescue NoHandlerFound => e
252
252
  puts "*** Handler not found for msg, #{e.message}"
253
253
  puts "*** Ensure a handler named, #{e.message}, is present in the
254
- MessageHandler directory."
254
+ messagehandler directory."
255
255
 
256
256
  @msg.add_error_msg(@mq.local_queue_name, e.message)
257
257
  serialized_object = YAML.dump(@msg)
@@ -338,7 +338,7 @@ module RServiceBus2
338
338
  @resource_manager.begin
339
339
  msg_name = @msg.msg.class.name
340
340
  handler_list = @handler_manager.get_handler_list_for_msg(msg_name)
341
- RServiceBus.rlog 'Handler found for: ' + msg_name
341
+ RServiceBus2.rlog 'Handler found for: ' + msg_name
342
342
  begin
343
343
  @queue_for_msgs_to_be_sent_on_complete = []
344
344
 
@@ -376,10 +376,10 @@ module RServiceBus2
376
376
  # All msg sending Methods
377
377
 
378
378
  # Sends a msg across the bus
379
- # @param [String] serialized_object serialized RServiceBus::Message
379
+ # @param [String] serialized_object serialized RServiceBus2::Message
380
380
  # @param [String] queue_name endpoint to which the msg will be sent
381
381
  def _send_already_wrapped_and_serialised(serialized_object, queue_name)
382
- RServiceBus.rlog 'Bus._send_already_wrapped_and_serialised'
382
+ RServiceBus2.rlog 'Bus._send_already_wrapped_and_serialised'
383
383
 
384
384
  unless @config.forward_sent_messages_to.nil?
385
385
  @mq.send(@config.forward_sent_messages_to, serialized_object)
@@ -389,21 +389,21 @@ module RServiceBus2
389
389
  end
390
390
 
391
391
  # Sends a msg across the bus
392
- # @param [RServiceBus::Message] msg msg to be sent
392
+ # @param [RServiceBus2::Message] msg msg to be sent
393
393
  # @param [String] queueName endpoint to which the msg will be sent
394
394
  def _send_needs_wrapping(msg, queue_name, correlation_id)
395
- RServiceBus.rlog 'Bus._send_needs_wrapping'
395
+ RServiceBus2.rlog 'Bus._send_needs_wrapping'
396
396
 
397
- r_msg = RServiceBus::Message.new(msg, @mq.local_queue_name, correlation_id)
397
+ r_msg = RServiceBus2::Message.new(msg, @mq.local_queue_name, correlation_id)
398
398
  if queue_name.index('@').nil?
399
399
  q = queue_name
400
- RServiceBus.rlog "Sending, #{msg.class.name} to, #{queue_name}"
400
+ RServiceBus2.rlog "Sending, #{msg.class.name} to, #{queue_name}"
401
401
  else
402
402
  parts = queue_name.split('@')
403
403
  r_msg.set_remote_queue_name(parts[0])
404
404
  r_msg.set_remote_host_name(parts[1])
405
405
  q = 'transport-out'
406
- RServiceBus.rlog "Sending, #{msg.class.name} to, #{queue_name}, via #{q}"
406
+ RServiceBus2.rlog "Sending, #{msg.class.name} to, #{queue_name}, via #{q}"
407
407
  end
408
408
 
409
409
  serialized_object = YAML.dump(r_msg)
@@ -429,9 +429,9 @@ module RServiceBus2
429
429
  # Sends a msg back across the bus
430
430
  # Reply queues are specified in each msg. It works like
431
431
  # email, where the reply address can actually be anywhere
432
- # @param [RServiceBus::Message] msg msg to be sent
432
+ # @param [RServiceBus2::Message] msg msg to be sent
433
433
  def reply(msg)
434
- RServiceBus.rlog 'Reply with: ' + msg.class.name + ' To: ' + @msg.return_address
434
+ RServiceBus2.rlog 'Reply with: ' + msg.class.name + ' To: ' + @msg.return_address
435
435
  @stats.inc_total_reply
436
436
 
437
437
  queue_msg_for_send_on_complete(msg, @msg.return_address)
@@ -451,9 +451,9 @@ module RServiceBus2
451
451
 
452
452
  # Send a msg across the bus
453
453
  # msg destination is specified at the infrastructure level
454
- # @param [RServiceBus::Message] msg msg to be sent
454
+ # @param [RServiceBus2::Message] msg msg to be sent
455
455
  def send( msg, timestamp=nil )
456
- RServiceBus.rlog 'Bus.Send'
456
+ RServiceBus2.rlog 'Bus.Send'
457
457
  @stats.inc_total_sent
458
458
 
459
459
  msg_name = msg.class.name
@@ -462,9 +462,9 @@ module RServiceBus2
462
462
  end
463
463
 
464
464
  # Sends an event to all subscribers across the bus
465
- # @param [RServiceBus::Message] msg msg to be sent
465
+ # @param [RServiceBus2::Message] msg msg to be sent
466
466
  def publish(msg)
467
- RServiceBus.rlog 'Bus.Publish'
467
+ RServiceBus2.rlog 'Bus.Publish'
468
468
  @stats.inc_total_published
469
469
 
470
470
  subscriptions = @subscription_manager.get(msg.class.name)
@@ -476,7 +476,7 @@ module RServiceBus2
476
476
  # Sends a subscription request across the Bus
477
477
  # @param [String] eventName event to be subscribes to
478
478
  def subscribe(event_name)
479
- RServiceBus.rlog 'Bus.Subscribe: ' + event_name
479
+ RServiceBus2.rlog 'Bus.Subscribe: ' + event_name
480
480
 
481
481
  queue_name = get_endpoint_for_msg(event_name)
482
482
  subscription = MessageSubscription.new(event_name)
@@ -44,7 +44,7 @@ module RServiceBus2
44
44
  @last_error_source_queue = source_queue
45
45
  @last_error_string = error_string
46
46
 
47
- @error_list << RServiceBus::ErrorMessage.new(source_queue, error_string)
47
+ @error_list << RServiceBus2::ErrorMessage.new(source_queue, error_string)
48
48
  end
49
49
 
50
50
  def set_remote_host_name(host_name)
@@ -113,14 +113,14 @@ module RServiceBus2
113
113
 
114
114
  file_list = Dir.glob("#{@path}/*")
115
115
  file_list.each do |file_path|
116
- RServiceBus.log "Ready to process, #{file_path}"
116
+ RServiceBus2.log "Ready to process, #{file_path}"
117
117
  content = process_path(file_path)
118
118
 
119
119
  unless @archivedir.nil?
120
120
  basename = File.basename(file_path)
121
121
  new_file_path = "#{@archivedir}/#{basename}.
122
122
  #{DateTime.now.strftime('%Y%m%d%H%M%S%L')}.zip"
123
- RServiceBus.log "Writing to archive, #{new_file_path}"
123
+ RServiceBus2.log "Writing to archive, #{new_file_path}"
124
124
 
125
125
  Zip::ZipOutputStream.open(new_file_path) do |zos|
126
126
  zos.put_next_entry(basename)
@@ -130,8 +130,8 @@ module RServiceBus2
130
130
  File.unlink(file_path)
131
131
 
132
132
  file_processed += 1
133
- RServiceBus.log "Processed #{file_processed} of #{file_list.length}."
134
- RServiceBus.log "Allow system tick #{self.class.name}"
133
+ RServiceBus2.log "Processed #{file_processed} of #{file_list.length}."
134
+ RServiceBus2.log "Allow system tick #{self.class.name}"
135
135
  break if file_processed >= max_files_processed
136
136
  end
137
137
  end
@@ -5,7 +5,7 @@ module RServiceBus2
5
5
  # Configure Monitors for an rservicebus host
6
6
  class ConfigureMonitor
7
7
  # Constructor
8
- # @param [RServiceBus::Host] host instance
8
+ # @param [RServiceBus2::Host] host instance
9
9
  # @param [Hash] resourceManager As hash[k,v] where k is the name of a
10
10
  # resource, and v is the resource
11
11
  def initialize(host, resource_manager)
@@ -18,10 +18,10 @@ module RServiceBus2
18
18
 
19
19
  # Assigns appropriate resources to writable attributes in the handler that
20
20
  # match keys in the resource hash
21
- # @param [RServiceBus::Handler] handler
21
+ # @param [RServiceBus2::Handler] handler
22
22
  def set_app_resources(monitor)
23
- RServiceBus.rlog "Checking app resources for: #{monitor.class.name}"
24
- RServiceBus.rlog "If your attribute is not getting set, check that it is
23
+ RServiceBus2.rlog "Checking app resources for: #{monitor.class.name}"
24
+ RServiceBus2.rlog "If your attribute is not getting set, check that it is
25
25
  in the 'attr_accessor' list"
26
26
  @resource_manager.get_all.each do |k, v|
27
27
  next unless monitor.class.method_defined?(k)
@@ -39,7 +39,7 @@ module RServiceBus2
39
39
  end
40
40
 
41
41
  if uri.path == '' || uri.path == '/'
42
- @local_queue_name = RServiceBus.get_value('APPNAME', 'RServiceBus')
42
+ @local_queue_name = RServiceBus2.get_value('APPNAME', 'RServiceBus')
43
43
  else
44
44
  @local_queue_name = uri.path
45
45
  @local_queue_name[0] = ''
@@ -53,7 +53,7 @@ module RServiceBus2
53
53
  abort
54
54
  end
55
55
 
56
- @timeout = RServiceBus.get_value('QUEUE_TIMEOUT', '5').to_i
56
+ @timeout = RServiceBus2.get_value('QUEUE_TIMEOUT', '5').to_i
57
57
  connect(uri.host, uri.port)
58
58
  subscribe(@local_queue_name)
59
59
  end
@@ -28,7 +28,7 @@ module RServiceBus2
28
28
  end
29
29
 
30
30
  # setBusAttributeIfRequested
31
- # @param [RServiceBus::Saga] saga
31
+ # @param [RServiceBus2::Saga] saga
32
32
  def set_bus_attribute_if_requested(saga)
33
33
  if defined?(saga.bus)
34
34
  saga.bus = @host
@@ -4,7 +4,7 @@ module RServiceBus2
4
4
  attr_reader :saga_list
5
5
 
6
6
  # Constructor
7
- # @param [RServiceBus::Host] host instance
7
+ # @param [RServiceBus2::Host] host instance
8
8
  # @param [Hash] appResources As hash[k,v] where k is the name of a
9
9
  # resource, and v is the resource
10
10
  def initialize(host, saga_manager)
@@ -31,7 +31,7 @@ module RServiceBus2
31
31
  # corrected.
32
32
  # @param [String] sagaName name of the saga to instantiate
33
33
  # @param [String] filePath the path to the file to be loaded
34
- # @return [RServiceBus::Saga] the loader
34
+ # @return [RServiceBus2::Saga] the loader
35
35
  def load_saga_from_file(saga_name, file_path)
36
36
  require_path = get_require_path(file_path)
37
37
 
@@ -52,7 +52,7 @@ module RServiceBus2
52
52
  # Wrapper function
53
53
  # @param [String] filePath
54
54
  # @param [String] sagaName
55
- # @returns [RServiceBus::Saga] saga
55
+ # @returns [RServiceBus2::Saga] saga
56
56
  def load_saga(file_path, saga_name)
57
57
  if @list_of_loaded_paths.key?(file_path)
58
58
  RServiceBus2.log "Not reloading, #{file_path}"
@@ -10,7 +10,7 @@ module RServiceBus2
10
10
  end
11
11
 
12
12
  def get_all
13
- RServiceBus.log 'Load subscriptions'
13
+ RServiceBus2.log 'Load subscriptions'
14
14
  return {} unless File.exist?(@uri.path)
15
15
 
16
16
  YAML.load(File.open(@uri.path))
@@ -2,7 +2,7 @@ require 'beanstalk-client'
2
2
  require 'rservicebus2'
3
3
  require 'net/ssh/gateway'
4
4
 
5
- module RServiceBus
5
+ module RServiceBus2
6
6
  class CouldNotConnectToDestination < StandardError
7
7
  end
8
8
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rservicebus2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guy Irvine