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 +4 -4
- data/lib/rservicebus2.rb +1 -1
- data/lib/rservicebus2/agent.rb +1 -1
- data/lib/rservicebus2/audit.rb +3 -3
- data/lib/rservicebus2/config.rb +8 -8
- data/lib/rservicebus2/handler_loader.rb +13 -15
- data/lib/rservicebus2/handler_manager.rb +10 -10
- data/lib/rservicebus2/host.rb +24 -24
- data/lib/rservicebus2/message.rb +1 -1
- data/lib/rservicebus2/monitor/dir.rb +4 -4
- data/lib/rservicebus2/monitor_configure.rb +4 -4
- data/lib/rservicebus2/mq.rb +2 -2
- data/lib/rservicebus2/saga/manager.rb +1 -1
- data/lib/rservicebus2/saga_loader.rb +3 -3
- data/lib/rservicebus2/subscription_storage/file.rb +1 -1
- data/lib/rservicebus2/transporter.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cefcebe817e07916ac889a97b5fe82fa755a68a
|
4
|
+
data.tar.gz: a6842886a0c4da7caceb7792d43c146f63011831
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23308f1c27bd7c8b382078320bbcbc5f72b33eaa3733f78200d270156c3527bb805b5c8127ad4f02bcfb02a1140af7bbefaf879be8b1f1078cbb2421a6cbc3e9
|
7
|
+
data.tar.gz: 818be84dbdb8d68244a00c3dbff927cff6b603461e92d5474d96655e1621681d4322b8cc32754f392766325d76bd4956ea6b764f054739efb7fb163459f5343b
|
data/lib/rservicebus2.rb
CHANGED
data/lib/rservicebus2/agent.rb
CHANGED
@@ -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 =
|
28
|
+
msg = RServiceBus2::Message.new(message_obj, return_address)
|
29
29
|
if queue_name.index('@').nil?
|
30
30
|
q = queue_name
|
31
31
|
else
|
data/lib/rservicebus2/audit.rb
CHANGED
@@ -3,10 +3,10 @@ module RServiceBus2
|
|
3
3
|
class Audit
|
4
4
|
def initialize(mq)
|
5
5
|
@mq = mq
|
6
|
-
audit_queue_name =
|
6
|
+
audit_queue_name = RServiceBus2.get_value('AUDIT_QUEUE_NAME')
|
7
7
|
if audit_queue_name.nil?
|
8
|
-
@sent_messages_to =
|
9
|
-
@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
|
data/lib/rservicebus2/config.rb
CHANGED
@@ -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', './
|
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', '
|
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/
|
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', './
|
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/
|
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}/
|
147
|
-
@saga_path_list << "#{path}/
|
148
|
-
@contract_list << "#{path}/
|
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 [
|
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
|
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 [
|
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 [
|
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
|
-
|
66
|
+
RServiceBus2.log "Not reloading, #{file_path}"
|
67
67
|
return
|
68
68
|
end
|
69
69
|
|
70
70
|
begin
|
71
|
-
|
72
|
-
|
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
|
-
|
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
|
-
|
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 = "
|
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
|
-
|
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
|
-
|
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 = "
|
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 [
|
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 [
|
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
|
-
|
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 [
|
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
|
-
|
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 [
|
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
|
-
|
55
|
-
|
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
|
-
|
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
|
-
|
100
|
+
RServiceBus2.rlog "App resource attribute, #{k}, set for: " + handler.class.name
|
101
101
|
end
|
102
102
|
end
|
103
103
|
end
|
data/lib/rservicebus2/host.rb
CHANGED
@@ -43,7 +43,7 @@ module RServiceBus2
|
|
43
43
|
|
44
44
|
# Thin veneer for Configuring state
|
45
45
|
def configure_saga_storage
|
46
|
-
string =
|
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
|
-
|
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 '
|
219
|
+
when 'RServiceBus2::MessageSubscription'
|
220
220
|
@subscription_manager.add(@msg.msg.event_name,
|
221
221
|
@msg.return_address)
|
222
|
-
when '
|
222
|
+
when 'RServiceBus2::MessageStatisticOutputOn'
|
223
223
|
@stats.output = true
|
224
224
|
log 'Turn on Stats logging'
|
225
|
-
when '
|
225
|
+
when 'RServiceBus2::MessageStatisticOutputOff'
|
226
226
|
@stats.output = false
|
227
227
|
log 'Turn off Stats logging'
|
228
|
-
when '
|
228
|
+
when 'RServiceBus2::MessageVerboseOutputOn'
|
229
229
|
ENV['VERBOSE'] = 'true'
|
230
230
|
log 'Turn on Verbose logging'
|
231
|
-
when '
|
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
|
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
|
-
|
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
|
-
|
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
|
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
|
-
|
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 [
|
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
|
-
|
395
|
+
RServiceBus2.rlog 'Bus._send_needs_wrapping'
|
396
396
|
|
397
|
-
r_msg =
|
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
|
-
|
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
|
-
|
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 [
|
432
|
+
# @param [RServiceBus2::Message] msg msg to be sent
|
433
433
|
def reply(msg)
|
434
|
-
|
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 [
|
454
|
+
# @param [RServiceBus2::Message] msg msg to be sent
|
455
455
|
def send( msg, timestamp=nil )
|
456
|
-
|
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 [
|
465
|
+
# @param [RServiceBus2::Message] msg msg to be sent
|
466
466
|
def publish(msg)
|
467
|
-
|
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
|
-
|
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)
|
data/lib/rservicebus2/message.rb
CHANGED
@@ -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 <<
|
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
|
-
|
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
|
-
|
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
|
-
|
134
|
-
|
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 [
|
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 [
|
21
|
+
# @param [RServiceBus2::Handler] handler
|
22
22
|
def set_app_resources(monitor)
|
23
|
-
|
24
|
-
|
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)
|
data/lib/rservicebus2/mq.rb
CHANGED
@@ -39,7 +39,7 @@ module RServiceBus2
|
|
39
39
|
end
|
40
40
|
|
41
41
|
if uri.path == '' || uri.path == '/'
|
42
|
-
@local_queue_name =
|
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 =
|
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
|
@@ -4,7 +4,7 @@ module RServiceBus2
|
|
4
4
|
attr_reader :saga_list
|
5
5
|
|
6
6
|
# Constructor
|
7
|
-
# @param [
|
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 [
|
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 [
|
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}"
|