rservicebus2 0.2.5 → 0.2.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c1e12570efafa3e17329ee11b4f458e86ba6d61700dea27f5552e3ef54945cd4
4
- data.tar.gz: 0ad1c7926d644e24f795d6baaacba9b18bbb60c51c6f8d2018b7829c2f02433a
3
+ metadata.gz: dd8b2dfcd1227fbfa6285ecee4096a893a6f034c9bb7106564da2423a7344c8e
4
+ data.tar.gz: de0f4dbbf5ac8f3b683485577a73f4f40d19f10705b2d487e13dbf2acd637ef4
5
5
  SHA512:
6
- metadata.gz: 2db9257198bff90b072fc80f1561e18373b831064f321e3d3238a37904a1026a506276f64d51eb575d21d9d7a5f58d5be4c27246e6e49608b569eb722f7e70fc
7
- data.tar.gz: 88f37e1a0d0837baf786ad2dfaf685f4bce862f62eebeca837275e06d37954a4681f0549b54b6e10757d9cce38a4fc1c99e68c58bb59c88be009584c1c0865cc
6
+ metadata.gz: a0214102bf52760d3b773ef194cde8718ba6113637f65e4791329109b3ba3fbe05ab9b94e4f9dffc0d39d55f9e2530d5ddfd64629b9ed6916f5cf2b9ee4d38f2
7
+ data.tar.gz: 329306b143ee14af68664432dfa7d541f82ef55d1695dd16f77ebb03dd3ffbd28a7bd19f1c6a116d2220bfad302903da6569b717b36e91980bb334eb1f2773d8
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  class QueueNotFoundForMsg < StandardError
3
5
  end
@@ -22,17 +24,17 @@ module RServiceBus2
22
24
  # @param [Object] messageObj The msg to be sent
23
25
  # @param [String] queueName the name of the queue to be send the msg to
24
26
  # @param [String] returnAddress the name of a queue to send replies to
25
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
27
+ # rubocop:disable Metrics/MethodLength
26
28
  def send_msg(message_obj, queue_name, return_address = nil)
27
- fail QueueNotFoundForMsg, message_obj.class.name if queue_name.nil?
29
+ raise QueueNotFoundForMsg, message_obj.class.name if queue_name.nil?
28
30
 
29
31
  msg = RServiceBus2::Message.new(message_obj, return_address)
30
32
  if queue_name.index('@').nil?
31
33
  q = queue_name
32
34
  else
33
35
  parts = queueName.split('@')
34
- msg.set_remote_queue_name(parts[0])
35
- msg.set_remote_host_name(parts[1])
36
+ msg.remote_queue_name = parts[0]
37
+ msg.remote_host_name = parts[1]
36
38
  q = 'transport-out'
37
39
  end
38
40
 
@@ -40,6 +42,7 @@ module RServiceBus2
40
42
 
41
43
  @mq.send(q, serialized_object)
42
44
  end
45
+ # rubocop:enable Metrics/MethodLength
43
46
 
44
47
  # Gives an agent the means to receive a reply
45
48
  #
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'uri'
2
4
 
3
5
  module RServiceBus2
@@ -8,7 +10,7 @@ module RServiceBus2
8
10
 
9
11
  # The method which actually connects to the resource.
10
12
  def connect(_uri)
11
- fail 'Method, connect, needs to be implemented for resource'
13
+ raise 'Method, connect, needs to be implemented for resource'
12
14
  end
13
15
 
14
16
  def _connect
@@ -16,7 +18,7 @@ module RServiceBus2
16
18
  RServiceBus2.rlog "#{self.class.name}. Connected to, #{@uri}"
17
19
  end
18
20
 
19
- def get_resource
21
+ def resource
20
22
  @connection
21
23
  end
22
24
 
@@ -44,22 +46,19 @@ module RServiceBus2
44
46
  rescue StandardError => e
45
47
  puts '** AppResource. An error was raised while closing connection
46
48
  to, ' + @uri
47
- puts 'Message: ' + e.message
49
+ puts "Message: #{e.message}"
48
50
  puts e.backtrace
49
51
  end
50
52
  _connect
51
53
  end
52
54
 
53
55
  # Transaction Semantics
54
- def begin
55
- end
56
+ def begin; end
56
57
 
57
58
  # Transaction Semantics
58
- def commit
59
- end
59
+ def commit; end
60
60
 
61
61
  # Transaction Semantics
62
- def rollback
63
- end
62
+ def rollback; end
64
63
  end
65
64
  end
@@ -1,16 +1,16 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'aws-sdk-dynamodb'
2
4
 
3
5
  module RServiceBus2
4
6
  # AppResourceAWSDynamoDb
5
7
  class AppResourceAWSDynamoDb < AppResource
6
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
7
8
  def connect(uri)
8
9
  region = uri.host
9
10
 
10
11
  Aws::DynamoDB::Client.new(region: region)
11
12
  end
12
13
 
13
- def finished
14
- end
14
+ def finished; end
15
15
  end
16
16
  end
@@ -0,0 +1,25 @@
1
+ require 'aws-sdk-sqs'
2
+ require 'aws-sdk-sts'
3
+
4
+ module RServiceBus2
5
+ # AppResourceAWSDynamoDb
6
+ class AppResourceAWSSQS < AppResource
7
+ def connect(uri)
8
+ queue_name = uri.path.sub('/', '')
9
+
10
+ region = uri.host
11
+
12
+ sts_client = Aws::STS::Client.new(region: region)
13
+ caller_identity_account = sts_client.get_caller_identity.account
14
+
15
+ queue_url = "https://sqs.#{region}.amazonaws.com/" \
16
+ "#{caller_identity_account}/#{queue_name}"
17
+ {
18
+ client: Aws::SQS::Client.new(region: region),
19
+ url: queue_url
20
+ }
21
+ end
22
+
23
+ def finished; end
24
+ end
25
+ end
@@ -1,12 +1,14 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'uri'
2
4
 
3
5
  module RServiceBus2
4
6
  # Configure AppResources for an rservicebus host
5
7
  class ConfigureAppResource
6
- # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,CyclomaticComplexity
8
+ # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
7
9
  def get_resources(env, host, state_manager, saga_storage)
8
- # rm = resource_manager
9
10
  rm = ResourceManager.new(state_manager, saga_storage)
11
+ # rubocop:disable Metrics/BlockLength
10
12
  env.each do |k, v|
11
13
  if v.is_a?(String) && k.start_with?('RSBFDB2_')
12
14
  uri = URI.parse(v)
@@ -15,8 +17,8 @@ module RServiceBus2
15
17
  k = k.sub('RSBFDB2_', '')
16
18
  rm.add k, AppResourceFluidDb2.new(host, uri)
17
19
  elsif v.is_a?(String) &&
18
- (k.start_with?('RSBFDB_') || v.index('fluiddb') == 0)
19
- v = v['fluiddb'.length..-1] if v.index('fluiddb') == 0
20
+ (k.start_with?('RSBFDB_') || v.start_with?('fluiddb'))
21
+ v = v['fluiddb'.length..-1] if v.start_with?('fluiddb')
20
22
  uri = URI.parse(v)
21
23
  require 'rservicebus2/appresource/fluiddb'
22
24
 
@@ -37,14 +39,19 @@ module RServiceBus2
37
39
  when 'awss3'
38
40
  require 'rservicebus2/appresource/awss3'
39
41
  rm.add k.sub('RSB_', ''), AppResourceAWSS3.new(host, uri)
42
+ when 'awssqs'
43
+ require 'rservicebus2/appresource/awssqs'
44
+ rm.add k.sub('RSB_', ''), AppResourceAWSSQS.new(host, uri)
40
45
  else
41
46
  abort("Scheme, #{uri.scheme}, not recognised when configuring
42
47
  app resource, #{k}=#{v}")
43
48
  end
44
49
  end
45
50
  end
51
+ # rubocop:enable Metrics/BlockLength
46
52
 
47
53
  rm
48
54
  end
55
+ # rubocop:enable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
49
56
  end
50
57
  end
@@ -1,8 +1,10 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  # Audit Class
3
5
  class Audit
4
- def initialize(mq)
5
- @mq = mq
6
+ def initialize(message_queue)
7
+ @mq = message_queue
6
8
  audit_queue_name = RServiceBus2.get_value('AUDIT_QUEUE_NAME')
7
9
  if audit_queue_name.nil?
8
10
  @sent_messages_to = RServiceBus2.get_value('sent_messages_to')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  class MessageArrivedWhileCricuitBroken < StandardError
3
5
  end
@@ -42,7 +44,7 @@ module RServiceBus2
42
44
  message_arrived
43
45
 
44
46
  ## logFirstFailure
45
- if @number_of_failures == 0
47
+ if @number_of_failures.zero?
46
48
  @number_of_failures = 1
47
49
  @time_of_first_failure = Time.now
48
50
  @time_to_break = @time_of_first_failure + @seconds_to_break
@@ -68,7 +70,7 @@ module RServiceBus2
68
70
  def message_arrived
69
71
  reset if !@time_to_break.nil? && Time.now > @time_to_break
70
72
 
71
- fail MessageArrivedWhileCricuitBroken if @broken == true
73
+ raise MessageArrivedWhileCricuitBroken if @broken == true
72
74
  end
73
75
 
74
76
  def break_circuit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  # Marshals configuration information for an rservicebus host
3
5
  class Config
@@ -19,7 +21,7 @@ module RServiceBus2
19
21
  end
20
22
 
21
23
  def get_value(name, default = nil)
22
- value = (ENV[name].nil? || ENV[name] == '') ? default : ENV[name]
24
+ value = ENV[name].nil? || ENV[name] == '' ? default : ENV[name]
23
25
  log "Env value: #{name}: #{value}"
24
26
  value
25
27
  end
@@ -131,21 +133,19 @@ module RServiceBus2
131
133
  # Note. trailing slashs will be stripped
132
134
  # Expected format: <path 1>;<path 2>
133
135
  def load_working_dir_list
134
- puts "Config.load_working_dir_list.1"
135
- puts "Config.load_working_dir_list.2 #{@contract_list}"
136
136
  path_list = get_value('WORKING_DIR', './')
137
137
  return self if path_list.nil?
138
138
 
139
139
  path_list.split(';').each do |path|
140
140
  path = path.strip.chomp('/')
141
- unless Dir.exist?("#{path}")
141
+ unless Dir.exist?(path.to_s)
142
142
  puts 'Error while processing working directory list'
143
143
  puts "*** path, #{path}, does not exist"
144
144
  abort
145
145
  end
146
146
  @handler_path_list << "#{path}/messagehandler" if Dir.exist?("#{path}/messagehandler")
147
147
  @saga_path_list << "#{path}/saga" if Dir.exist?("#{path}/saga")
148
- @contract_list << "#{path}/contract.rb" if File.exist?( "#{path}/contract.rb" )
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
@@ -154,14 +154,14 @@ module RServiceBus2
154
154
 
155
155
  # Class
156
156
  class ConfigFromEnv < Config
157
- def initialize
158
- end
157
+ def initialize; end;
159
158
  end
160
159
 
161
160
  # Class
162
161
  class ConfigFromSetter < Config
163
- attr_writer :appName, :messageEndpointMappings, :handler_path_list, :errorQueueName, :maxRetries, :forward_received_messages_to, :beanstalkHost
164
- def initialize
165
- end
162
+ attr_writer :app_name, :message_endpoint_mappings, :handler_path_list, :error_queue_name, \
163
+ :max_retries, :forward_received_messages_to, :beanstalk_host
164
+
165
+ def initialize; end;
166
166
  end
167
167
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'parse-cron'
2
4
 
3
5
  module RServiceBus2
@@ -27,7 +29,8 @@ module RServiceBus2
27
29
  @msg_names.each do |n|
28
30
  list << n if Globber.new(name) =~ n
29
31
  end
30
- fail NoMatchingMsgForCron, name if list.length == 0
32
+ raise NoMatchingMsgForCron, name if list.empty?
33
+
31
34
  list
32
35
  end
33
36
 
@@ -44,6 +47,7 @@ module RServiceBus2
44
47
  end
45
48
  end
46
49
 
50
+ # rubocop:disable Metrics/MethodLength
47
51
  def initialize(host, msg_names = [])
48
52
  @bus = host
49
53
  @msg_names = msg_names
@@ -61,6 +65,7 @@ module RServiceBus2
61
65
  end
62
66
  end
63
67
  end
68
+ # rubocop:enable Metrics/MethodLength
64
69
 
65
70
  def run
66
71
  now = Time.now
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  # Marshals data for message end points
3
5
  # Expected format: <msg mame 1>:<end point 1>;<msg mame 2>:<end point 2>
@@ -6,16 +8,18 @@ module RServiceBus2
6
8
  RServiceBus2.get_value(name)
7
9
  end
8
10
 
9
- def log(string, _ver = false)
11
+ def log(string, _ver: false)
10
12
  RServiceBus2.log(string)
11
13
  end
12
14
 
15
+ # rubocop:disable Metrics/AbcSize
16
+ # rubocop:disable Metrics/MethodLength
13
17
  def configure_mapping(mapping)
14
18
  match = mapping.match(/(.+):(.+)/)
15
19
  if match.nil?
16
- log 'Mapping string provided is invalid'
17
- log "The entire mapping string is: #{mapping}"
18
- log "*** Could not find ':' in mapping entry, #{line}"
20
+ log 'Mapping string provided is invalid\n' \
21
+ "The entire mapping string is: #{mapping}\n" \
22
+ "*** Could not find ':' in mapping entry, #{line}\n"
19
23
  exit
20
24
  end
21
25
 
@@ -23,16 +27,19 @@ module RServiceBus2
23
27
  @endpoints[match[1]] = match[2]
24
28
 
25
29
  @queue_name_list.each do |q|
26
- if q != match[2] && q.downcase == match[2].downcase
27
- log('*** Two queues specified with only case sensitive difference.')
28
- log("*** #{q} != #{match[2]}")
29
- log('*** If you meant these queues to be the same, please match case
30
- and restart the bus.')
31
- end
30
+ next unless q != match[2] && q.downcase == match[2].downcase
31
+
32
+ log('*** Two queues specified with only case sensitive difference.')
33
+ log("*** #{q} != #{match[2]}")
34
+ log('*** If you meant these queues to be the same, please match case
35
+ and restart the bus.')
32
36
  end
33
37
  @queue_name_list << match[2]
34
38
  end
39
+ # rubocop:enable Metrics/AbcSize
40
+ # rubocop:enable Metrics/MethodLength
35
41
 
42
+ # rubocop:disable Metrics/MethodLength
36
43
  def configure(local_queue_name = nil)
37
44
  log('EndpointMapping.Configure')
38
45
 
@@ -40,9 +47,9 @@ module RServiceBus2
40
47
  @queue_name_list << local_queue_name unless local_queue_name.nil?
41
48
 
42
49
  unless get_value('MESSAGE_ENDPOINT_MAPPING').nil?
43
- log('*** MESSAGE_ENDPOINT_MAPPING environment variable was detected')
44
- log("*** You may have intended MESSAGE_ENDPOINT_MAPPINGS, note the 'S'
45
- on the end")
50
+ log '*** MESSAGE_ENDPOINT_MAPPING environment variable was detected\n' \
51
+ "*** You may have intended MESSAGE_ENDPOINT_MAPPINGS, note the 'S'
52
+ on the end"
46
53
  end
47
54
 
48
55
  mappings = get_value('MESSAGE_ENDPOINT_MAPPINGS')
@@ -54,6 +61,7 @@ module RServiceBus2
54
61
 
55
62
  self
56
63
  end
64
+ # rubocop:enable Metrics/MethodLength
57
65
 
58
66
  def initialize
59
67
  @endpoints = {}
@@ -65,7 +73,7 @@ module RServiceBus2
65
73
  nil
66
74
  end
67
75
 
68
- def get_subscription_endpoints
76
+ def subscription_endpoints
69
77
  @endpoints.keys.select { |el| el.end_with?('Event') }
70
78
  end
71
79
  end
@@ -1,11 +1,12 @@
1
- module RServiceBus2
1
+ # frozen_string_literal: true
2
2
 
3
+ module RServiceBus2
3
4
  # Error Message
4
5
  class ErrorMessage
5
6
  attr_reader :occurredat, :source_queue, :error_msg
6
7
 
7
8
  def initialize(source_queue, error_msg)
8
- @occurredat = DateTime.now
9
+ @occurredat = Time.now
9
10
 
10
11
  @source_queue = source_queue
11
12
  @error_msg = error_msg
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module RServiceBus2
2
4
  # Given a directory, this class is responsible for finding
3
5
  # msgnames,
4
6
  # handlernames, and
5
7
  # loading handlers
6
8
  class HandlerLoader
7
- attr_reader :handlerList
9
+ # attr_reader :handlerList - 8 May 2021
8
10
 
9
11
  # Constructor
10
12
  #
@@ -22,12 +24,11 @@ module RServiceBus2
22
24
  # Cleans the given path to ensure it can be used for as a parameter for the require statement.
23
25
  # @param [String] file_path the path to be cleaned
24
26
  def get_require_path(file_path)
25
- file_path = './' + file_path unless file_path.start_with?('/')
27
+ file_path = "./#{file_path}" unless file_path.start_with?('/')
26
28
 
27
29
  return file_path.sub('.rb', '') if File.exist?(file_path)
28
30
 
29
- abort('Filepath, ' + file_path + ", given for messagehandler require
30
- doesn't exist")
31
+ abort("Filepath, #{file_path}, given for messagehandler require doesn't exist")
31
32
  end
32
33
 
33
34
  # Instantiate the handler named in handlerName from the file name in
@@ -38,6 +39,7 @@ module RServiceBus2
38
39
  # @param [String] handler_name name of the handler to instantiate
39
40
  # @param [String] file_path the path to the file to be loaded
40
41
  # @return [RServiceBus2::Handler] the loader
42
+ # rubocop:disable Metrics/MethodLength
41
43
  def load_handler_from_file(handler_name, file_path)
42
44
  require_path = get_require_path(file_path)
43
45
 
@@ -45,22 +47,22 @@ module RServiceBus2
45
47
  begin
46
48
  handler = Object.const_get(handler_name).new
47
49
  rescue StandardError => e
48
- puts 'Expected class name: ' + handler_name + ', not found after
49
- require: ' + require_path
50
- puts '**** Check in ' + file_path + ' that the class is named : ' +
51
- handler_name
52
- puts '( In case its not that )'
50
+ puts "Expected class name: #{handler_name}, not found after require: #{require_path}\n" \
51
+ "**** Check in #{file_path} that the class is named: #{handler_name}\n" \
52
+ '( In case its not that )'
53
53
  raise e
54
54
  end
55
55
 
56
56
  handler
57
57
  end
58
+ # rubocop:enable Metrics/MethodLength
58
59
 
59
60
  # Wrapper function
60
61
  #
61
62
  # @param [String] file_path
62
63
  # @param [String] handler_name
63
64
  # @returns [RServiceBus2::Handler] handler
65
+ # rubocop:disable Metrics/MethodLength
64
66
  def load_handler(msg_name, file_path, handler_name)
65
67
  if @list_of_loaded_paths.key?(file_path)
66
68
  RServiceBus2.log "Not reloading, #{file_path}"
@@ -68,29 +70,30 @@ module RServiceBus2
68
70
  end
69
71
 
70
72
  begin
71
- RServiceBus2.rlog 'file_path: ' + file_path
72
- RServiceBus2.rlog 'handler_name: ' + handler_name
73
+ RServiceBus2.rlog "file_path: #{file_path}"
74
+ RServiceBus2.rlog "handler_name: #{handler_name}"
73
75
 
74
76
  handler = load_handler_from_file(handler_name, file_path)
75
- RServiceBus2.log 'Loaded Handler: ' + handler_name
77
+ RServiceBus2.log "Loaded Handler: #{handler_name}"
76
78
 
77
79
  @handler_manager.add_handler(msg_name, handler)
78
80
 
79
81
  @list_of_loaded_paths[file_path] = 1
80
82
  rescue StandardError => e
81
- puts 'Exception loading handler from file: ' + file_path
83
+ puts "Exception loading handler from file: #{file_path}"
82
84
  puts e.message
83
85
  puts e.backtrace[0]
84
86
  abort
85
87
  end
86
88
  end
89
+ # rubocop:enable Metrics/MethodLength
87
90
 
88
91
  # This method is overloaded for unit tests
89
92
  #
90
93
  # @param [String] path directory to check
91
94
  # @return [Array] a list of paths to files found in the given path
92
95
  def get_list_of_files_for_dir(path)
93
- list = Dir[path + '/*']
96
+ list = Dir["#{path}/*"]
94
97
  RServiceBus2.rlog "HandlerLoader.getListOfFilesForDir. path: #{path},
95
98
  list: #{list}"
96
99
  list
@@ -105,14 +108,14 @@ module RServiceBus2
105
108
  def load_handlers_from_second_level_path(msg_name, base_dir)
106
109
  get_list_of_files_for_dir(base_dir).each do |file_path|
107
110
  next if file_path.end_with?('.')
111
+ next unless !File.directory?(file_path) && File.extname(file_path) == '.rb'
108
112
 
109
- ext_name = File.extname(file_path)
110
- if !File.directory?(file_path) && ext_name == '.rb'
111
- file_name = File.basename(file_path).sub('.rb', '')
112
- handler_name = "message_handler_#{msg_name}_#{file_name}".gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1') # Classify
113
+ file_name = File.basename(file_path).sub('.rb', '')
114
+ # Classify
115
+ handler_name = "message_handler_#{msg_name}_#{file_name}"
116
+ .gsub(/(?<=_|^)(\w)/) { Regexp.last_match(1).upcase }.gsub(/(?:_)(\w)/, '\1')
113
117
 
114
- load_handler(msg_name, file_path, handler_name)
115
- end
118
+ load_handler(msg_name, file_path, handler_name)
116
119
  end
117
120
 
118
121
  self
@@ -130,22 +133,26 @@ module RServiceBus2
130
133
  # Load top level handlers from the given directory
131
134
  #
132
135
  # @param [String] baseDir directory to check - should not have trailing slash
136
+ # rubocop:disable Metrics/MethodLength
133
137
  def load_handlers_from_top_level_path(base_dir)
134
138
  RServiceBus2.rlog "HandlerLoader.loadHandlersFromTopLevelPath. baseDir: #{base_dir}"
135
139
  get_list_of_files_for_dir(base_dir).each do |file_path|
136
- unless file_path.end_with?('.')
137
- msg_name = get_msg_name(file_path)
138
- if File.directory?(file_path)
139
- load_handlers_from_second_level_path(msg_name, file_path)
140
- else
141
- handler_name = "message_handler_#{msg_name}".gsub(/(?<=_|^)(\w)/){$1.upcase}.gsub(/(?:_)(\w)/,'\1') # Classify
142
- load_handler(msg_name, file_path, handler_name)
143
- end
140
+ next if file_path.end_with?('.')
141
+
142
+ msg_name = get_msg_name(file_path)
143
+ if File.directory?(file_path)
144
+ load_handlers_from_second_level_path(msg_name, file_path)
145
+ else
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)
144
150
  end
145
151
  end
146
152
 
147
153
  self
148
154
  end
155
+ # rubocop:enable Metrics/MethodLength
149
156
 
150
157
  # Entry point for loading handlers
151
158
  #