rservicebus2 0.2.19 → 0.2.20
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/bin/return_messages_to_source_queue +2 -1
- data/lib/rservicebus2/agent.rb +1 -1
- data/lib/rservicebus2/handler_loader.rb +10 -5
- data/lib/rservicebus2/helper_functions.rb +20 -0
- data/lib/rservicebus2/host.rb +1 -1
- data/lib/rservicebus2/message.rb +2 -2
- data/lib/rservicebus2/monitor/dirnotifier.rb +27 -11
- data/lib/rservicebus2/saga_storage/dir.rb +1 -1
- data/lib/rservicebus2/sendat_storage/file.rb +1 -1
- data/lib/rservicebus2/state_storage/dir.rb +1 -1
- data/lib/rservicebus2/subscription_storage/file.rb +2 -2
- data/lib/rservicebus2/transporter.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f586d7a257549f1a8bbac85940e7740bc6927928b75e3254254cf1a945aefa38
|
4
|
+
data.tar.gz: 3e2352c5ddebf9cb4583a67106e4286a54f0b75f67c0fa1f485b56bd70c1dd94
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: efbdcb52173f9caff80c659e2aae973deeaef5d9cc5adf31d9d251f8c88ef6cf1b212514ed07a88ab36efb7e5e84b83d1938710e5b50ae50049b0b04907df325
|
7
|
+
data.tar.gz: 5aeed54b1b619ba5f6b6a2c9221e868770575f88c18f3426ff23ee46abfc7ff62424c5a3a1609e5487bb36e0b0f1b5edfa09ac8cf920b64a4d5a385f3c26434f
|
@@ -13,7 +13,8 @@ def return_msg(beanstalk, job, request_nbr)
|
|
13
13
|
|
14
14
|
msg_name = payload.match('(\w*)', start_index)[1]
|
15
15
|
|
16
|
-
msg =
|
16
|
+
msg = RServiceBus2.safe_load(payload)
|
17
|
+
|
17
18
|
if msg.last_error_string.nil?
|
18
19
|
puts "*** Requested msg, #{request_nbr}, does not have a sourceQueue to
|
19
20
|
which it can be returned"
|
data/lib/rservicebus2/agent.rb
CHANGED
@@ -140,14 +140,19 @@ module RServiceBus2
|
|
140
140
|
next if file_path.end_with?('.')
|
141
141
|
|
142
142
|
msg_name = get_msg_name(file_path)
|
143
|
+
RServiceBus2.add_to_permitted_classes(
|
144
|
+
msg_name.gsub(/(?<=_|^)(\w)/) { Regexp.last_match(1).upcase }.gsub(/(?:_)(\w)/, '\1')
|
145
|
+
)
|
146
|
+
|
143
147
|
if File.directory?(file_path)
|
144
148
|
load_handlers_from_second_level_path(msg_name, file_path)
|
145
|
-
|
146
|
-
# Classify
|
147
|
-
handler_name = "message_handler_#{msg_name}"
|
148
|
-
.gsub(/(?<=_|^)(\w)/) { Regexp.last_match(1).upcase }.gsub(/(?:_)(\w)/, '\1')
|
149
|
-
load_handler(msg_name, file_path, handler_name)
|
149
|
+
next
|
150
150
|
end
|
151
|
+
|
152
|
+
# Classify
|
153
|
+
handler_name = "message_handler_#{msg_name}"
|
154
|
+
.gsub(/(?<=_|^)(\w)/) { Regexp.last_match(1).upcase }.gsub(/(?:_)(\w)/, '\1')
|
155
|
+
load_handler(msg_name, file_path, handler_name)
|
151
156
|
end
|
152
157
|
|
153
158
|
self
|
@@ -1,7 +1,27 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'csv'
|
4
|
+
|
3
5
|
# Helper functions
|
4
6
|
module RServiceBus2
|
7
|
+
DEFAULT_PERMITTED_CLASSES = 'RServiceBus2::Message,Time,UUIDTools::UUID'
|
8
|
+
|
9
|
+
def self.permitted_classes
|
10
|
+
permitted_classes_string = get_value('PERMITTED_CLASSES', DEFAULT_PERMITTED_CLASSES)
|
11
|
+
CSV.parse(permitted_classes_string)[0]
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.add_to_permitted_classes(string)
|
15
|
+
ENV['PERMITTED_CLASSES'] = permitted_classes
|
16
|
+
.push(string)
|
17
|
+
.uniq
|
18
|
+
.to_csv
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.safe_load(body)
|
22
|
+
YAML.safe_load(body, permitted_classes: permitted_classes)
|
23
|
+
end
|
24
|
+
|
5
25
|
def self.convert_dto_to_hash(obj)
|
6
26
|
hash = {}
|
7
27
|
obj.instance_variables.each do |var|
|
data/lib/rservicebus2/host.rb
CHANGED
@@ -162,7 +162,7 @@ module RServiceBus2
|
|
162
162
|
body = @mq.pop
|
163
163
|
begin
|
164
164
|
@stats.inc_total_processed
|
165
|
-
@msg =
|
165
|
+
@msg = RServiceBus2.safe_load(body)
|
166
166
|
case @msg.msg.class.name
|
167
167
|
when 'RServiceBus2::MessageSubscription'
|
168
168
|
@subscription_manager.add(@msg.msg.event_name,
|
data/lib/rservicebus2/message.rb
CHANGED
@@ -55,9 +55,9 @@ module RServiceBus2
|
|
55
55
|
|
56
56
|
# @return [Object] The msg to be sent
|
57
57
|
def msg
|
58
|
-
return
|
58
|
+
return RServiceBus2.safe_load(Zlib::Inflate.inflate(@_msg)) if @compressed == true
|
59
59
|
|
60
|
-
|
60
|
+
RServiceBus2.safe_load(@_msg)
|
61
61
|
rescue ArgumentError => e
|
62
62
|
raise e if e.message.index('undefined class/module ').nil?
|
63
63
|
|
@@ -9,30 +9,46 @@ module RServiceBus2
|
|
9
9
|
class MonitorDirNotifier < Monitor
|
10
10
|
attr_reader :path, :processing_folder, :filter
|
11
11
|
|
12
|
+
def directory_not_writable(path, param_name)
|
13
|
+
"***** #{param_name} is not writable, #{path}.\n" \
|
14
|
+
"***** Make the directory, #{path}, writable and try again."
|
15
|
+
end
|
16
|
+
|
17
|
+
def directory_does_not_exist(path, param_name)
|
18
|
+
"***** #{param_name} does not exist, #{path}.\n" \
|
19
|
+
"***** Create the directory, #{path}, and try again.\n" \
|
20
|
+
"***** eg, mkdir #{path}"
|
21
|
+
end
|
22
|
+
|
23
|
+
def path_is_not_a_directory(path)
|
24
|
+
"***** The specified path does not point to a directory, #{path}.\n" \
|
25
|
+
"***** Either repoint path to a directory, or remove, #{path}, and create it as a directory.\n" \
|
26
|
+
"***** eg, rm #{path} && mkdir #{path}"
|
27
|
+
end
|
28
|
+
|
29
|
+
def processing_directory_not_specified(path)
|
30
|
+
'***** Processing Directory is not specified.' \
|
31
|
+
'***** Specify the Processing Directory as a query string in the Path URI' \
|
32
|
+
"***** eg, '/#{path}?processing=*ProcessingDir*'"
|
33
|
+
end
|
34
|
+
|
12
35
|
def validate_directory(path, param_name)
|
13
36
|
open_folder path
|
14
37
|
return if File.writable?(path)
|
15
38
|
|
16
|
-
puts
|
17
|
-
***** Make the directory, #{path}, writable and try again."
|
39
|
+
puts directory_not_writable(path, param_name)
|
18
40
|
abort
|
19
41
|
rescue Errno::ENOENT
|
20
|
-
puts
|
21
|
-
"***** Create the directory, #{path}, and try again.\n" \
|
22
|
-
"***** eg, mkdir #{path}"
|
42
|
+
puts directory_does_not_exist(path, param_name)
|
23
43
|
abort
|
24
44
|
rescue Errno::ENOTDIR
|
25
|
-
puts
|
26
|
-
***** Either repoint path to a directory, or remove, #{path}, and create it as a directory.
|
27
|
-
***** eg, rm #{path} && mkdir #{path}"
|
45
|
+
puts path_is_not_a_directory(path)
|
28
46
|
abort
|
29
47
|
end
|
30
48
|
|
31
49
|
def validate_processing_directory(uri)
|
32
50
|
if uri.query.nil?
|
33
|
-
puts
|
34
|
-
'***** Specify the Processing Directory as a query string in the Path URI' \
|
35
|
-
"***** eg, '/#{uri.path}?processing=*ProcessingDir*'"
|
51
|
+
puts processing_directory_not_specified(uri.path)
|
36
52
|
abort
|
37
53
|
end
|
38
54
|
|
@@ -7,11 +7,11 @@ module RServiceBus2
|
|
7
7
|
RServiceBus2.log 'Load subscriptions'
|
8
8
|
return {} unless File.exist?(@uri.path)
|
9
9
|
|
10
|
-
|
10
|
+
RServiceBus2.safe_load(File.open(@uri.path))
|
11
11
|
end
|
12
12
|
|
13
13
|
def add(event_name, queue_name)
|
14
|
-
s = File.exist?(@uri.path) ?
|
14
|
+
s = File.exist?(@uri.path) ? RServiceBus2.safe_load(File.open(@uri.path)) : {}
|
15
15
|
s[event_name] = [] if s[event_name].nil?
|
16
16
|
|
17
17
|
s[event_name] << queue_name
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rservicebus2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.20
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Guy Irvine
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: beanstalk-client
|