ruby_rabbitmq_janus 3.0.0.pre.384 → 4.0.0.pre.850041590

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -6
  3. data/config/default.yml +5 -5
  4. data/lib/rrj/errors/error.rb +3 -1
  5. data/lib/rrj/errors/janus/janus.rb +10 -11
  6. data/lib/rrj/errors/janus/responses/admin.rb +1 -1
  7. data/lib/rrj/errors/janus/responses/event.rb +1 -1
  8. data/lib/rrj/errors/janus/responses/standard.rb +1 -1
  9. data/lib/rrj/errors/rabbit/rabbit.rb +40 -13
  10. data/lib/rrj/errors/tools/tools.rb +45 -9
  11. data/lib/rrj/info.rb +1 -1
  12. data/lib/rrj/models/active_record.rb +1 -3
  13. data/lib/rrj/process/concurrency.rb +3 -9
  14. data/lib/rrj/rabbit/connect.rb +7 -5
  15. data/lib/rrj/tools/gem/config.rb +1 -1
  16. data/lib/rrj/tools/gem/config/gem.rb +1 -1
  17. data/lib/rrj/tools/gem/config/janus.rb +2 -0
  18. data/lib/rrj/tools/gem/config/queues.rb +8 -0
  19. data/lib/rrj/tools/gem/config/rabbit.rb +2 -0
  20. data/lib/rrj/tools/replaces/replace.rb +2 -2
  21. data/spec/config/database.yml +1 -0
  22. data/spec/ruby_rabbitmq_janus/models/janus_instance_instance_spec.rb +1 -1
  23. data/spec/ruby_rabbitmq_janus/rrj_admin_add_token_spec.rb +1 -0
  24. data/spec/ruby_rabbitmq_janus/rrj_admin_allow_token_spec.rb +1 -0
  25. data/spec/ruby_rabbitmq_janus/rrj_admin_disallow_token_spec.rb +1 -0
  26. data/spec/ruby_rabbitmq_janus/rrj_admin_handle_info_spec.rb +1 -0
  27. data/spec/ruby_rabbitmq_janus/{rrj_admin_list_handles_spec.Rb → rrj_admin_list_handles_spec.rb} +1 -0
  28. data/spec/ruby_rabbitmq_janus/rrj_admin_list_sessions_spec.rb +1 -0
  29. data/spec/ruby_rabbitmq_janus/rrj_admin_list_tokens_spec.rb +1 -0
  30. data/spec/ruby_rabbitmq_janus/rrj_admin_remove_token_spec.rb +1 -0
  31. data/spec/ruby_rabbitmq_janus/rrj_admin_set_libnice_debug_spec.rb +1 -0
  32. data/spec/ruby_rabbitmq_janus/rrj_admin_set_locking_debug_spec.rb +1 -0
  33. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_colors_spec.rb +1 -0
  34. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_level_spec.rb +1 -0
  35. data/spec/ruby_rabbitmq_janus/rrj_admin_set_log_timestamps_spec.rb +1 -0
  36. data/spec/ruby_rabbitmq_janus/rrj_admin_set_max_nack_queue_spec.rb +1 -0
  37. data/spec/ruby_rabbitmq_janus/rrj_admin_set_no_media_timer_spec.rb +1 -0
  38. data/spec/ruby_rabbitmq_janus/rrj_admin_set_session_timeout_spec.rb +1 -0
  39. data/spec/ruby_rabbitmq_janus/rrj_admin_start_pcap_spec.rb +1 -0
  40. data/spec/ruby_rabbitmq_janus/rrj_admin_start_text2pcap_spec.rb +1 -0
  41. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_pcap_spec.rb +1 -0
  42. data/spec/ruby_rabbitmq_janus/rrj_admin_stop_text2pcap_spec.rb +1 -0
  43. data/spec/ruby_rabbitmq_janus/rrj_answer_spec.rb +1 -0
  44. data/spec/ruby_rabbitmq_janus/rrj_attach_spec.rb +1 -0
  45. data/spec/ruby_rabbitmq_janus/rrj_create_spec.rb +1 -0
  46. data/spec/ruby_rabbitmq_janus/rrj_destroy_spec.rb +1 -0
  47. data/spec/ruby_rabbitmq_janus/rrj_detach_spec.rb +1 -0
  48. data/spec/ruby_rabbitmq_janus/rrj_info_spec.rb +1 -0
  49. data/spec/ruby_rabbitmq_janus/rrj_keepalive_spec.rb +1 -0
  50. data/spec/ruby_rabbitmq_janus/rrj_offer_spec.rb +1 -0
  51. data/spec/ruby_rabbitmq_janus/rrj_trickle_spec.rb +1 -0
  52. data/spec/ruby_rabbitmq_janus/rrj_trickles_spec.rb +2 -1
  53. data/spec/spec_helper.rb +34 -31
  54. data/spec/support/examples_thread.rb +5 -5
  55. metadata +150 -139
  56. data/lib/rrj/errors/base/admin.rb +0 -24
  57. data/lib/rrj/errors/base/base.rb +0 -5
  58. data/lib/rrj/errors/base/init.rb +0 -46
  59. data/lib/rrj/errors/base/task.rb +0 -32
  60. data/lib/rrj/errors/janus/messages/admin.rb +0 -33
  61. data/lib/rrj/errors/janus/messages/message.rb +0 -51
  62. data/lib/rrj/errors/janus/messages/standard.rb +0 -33
  63. data/lib/rrj/errors/janus/responses/base.rb +0 -15
  64. data/lib/rrj/errors/janus/transactions/admin.rb +0 -37
  65. data/lib/rrj/errors/janus/transactions/handle.rb +0 -52
  66. data/lib/rrj/errors/janus/transactions/session.rb +0 -38
  67. data/lib/rrj/errors/janus/transactions/transaction.rb +0 -23
  68. data/lib/rrj/errors/rabbit/base_event.rb +0 -25
  69. data/lib/rrj/errors/rabbit/connect.rb +0 -65
  70. data/lib/rrj/errors/rabbit/listener/base.rb +0 -46
  71. data/lib/rrj/errors/rabbit/listener/from.rb +0 -19
  72. data/lib/rrj/errors/rabbit/listener/from_admin.rb +0 -19
  73. data/lib/rrj/errors/rabbit/propertie.rb +0 -37
  74. data/lib/rrj/errors/rabbit/publisher/admin.rb +0 -32
  75. data/lib/rrj/errors/rabbit/publisher/base.rb +0 -39
  76. data/lib/rrj/errors/rabbit/publisher/exclusive.rb +0 -33
  77. data/lib/rrj/errors/rabbit/publisher/keepalive.rb +0 -19
  78. data/lib/rrj/errors/rabbit/publisher/non_exclusive.rb +0 -33
  79. data/lib/rrj/errors/tools/gem/cluster.rb +0 -42
  80. data/lib/rrj/errors/tools/gem/config.rb +0 -121
  81. data/lib/rrj/errors/tools/gem/log.rb +0 -81
  82. data/lib/rrj/errors/tools/gem/option.rb +0 -44
  83. data/lib/rrj/errors/tools/gem/request.rb +0 -23
  84. data/lib/rrj/errors/tools/replaces/replace.rb +0 -30
  85. data/lib/rrj/errors/tools/replaces/type.rb +0 -30
  86. data/tmp/coverage/assets/0.10.2/application.css +0 -799
  87. data/tmp/coverage/assets/0.10.2/application.js +0 -1707
  88. data/tmp/coverage/assets/0.10.2/colorbox/border.png +0 -0
  89. data/tmp/coverage/assets/0.10.2/colorbox/controls.png +0 -0
  90. data/tmp/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
  91. data/tmp/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
  92. data/tmp/coverage/assets/0.10.2/favicon_green.png +0 -0
  93. data/tmp/coverage/assets/0.10.2/favicon_red.png +0 -0
  94. data/tmp/coverage/assets/0.10.2/favicon_yellow.png +0 -0
  95. data/tmp/coverage/assets/0.10.2/loading.gif +0 -0
  96. data/tmp/coverage/assets/0.10.2/magnify.png +0 -0
  97. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  98. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  99. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  100. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  101. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  102. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  103. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  104. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  105. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
  106. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  107. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
  108. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
  109. data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  110. data/tmp/coverage/index.html +0 -21339
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e3f09817fed0214a2ce8a776ea6cb6c7c3ea893c24f56af5c2cec9855883d5f5
4
- data.tar.gz: 108b9f75fbb86c4698ada11ff575568e5e80d7ee42c46a05da9713b375414868
3
+ metadata.gz: 2d2de468e1a126345a12e766cb4e8084596f1dcbc9e723cb04cb84aeb08da1ea
4
+ data.tar.gz: 7abc77fcbc6d4b1933c3cb12b3ef0bf261e8fd5dce5dad763557b27ffb9bbf70
5
5
  SHA512:
6
- metadata.gz: fbfce5a5a397afbfcb3e25a4f435f7149382584146099ab6f0e8eb73e4f64095e38401a74b38c581765e3c6592f5b7807f88007bdd2b91ca172e7241528b0fea
7
- data.tar.gz: 32d45c9f76089d812d71ca10b2c085f160cabe3f85ffbe54d56075cc9db81eaaf83a111d05c8536d3d63cc40084fffc5bb52241ab853b4988a9636eb6d042a9d
6
+ metadata.gz: f067f57efb5947d0c1897a4cab46bdc3b9ec052a5a67b62cf016d4cba61333df4f9b86f38bcf9311a850e4838814e07f4bd45e75761370bf973d73007119fbcc
7
+ data.tar.gz: bd68ad010e4f72df7cc35afe6b9f818e29e6aef44d14018c09ed06bec982509438fb0a8272987c596b4c28b72894f7b5d4a4f659b2cb001fded8383867b6b930
data/README.md CHANGED
@@ -33,7 +33,6 @@ This gem is product by [Dazzl.tv](http://dazzl.tv)
33
33
  * [Read documentation](#read-documentation)
34
34
  * [Generate developer documentation](#generate-developer-documentation)
35
35
  * [Contributing](#contributing)
36
- * [Plus](#plus)
37
36
 
38
37
  ## How to use
39
38
 
@@ -281,8 +280,3 @@ Bug reports and pull requests are welcome on GitHub at
281
280
  https://github.com/dazzl-tv/ruby-rabbitmq-janus This project is intended to be a
282
281
  safe, welcoming space for collaboration, and contributors are expected to adhere
283
282
  to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
284
-
285
- ## Plus
286
-
287
- Janus Admin Monitor project use this gem for manage data in Janus Meetecho with
288
- Admin/Monitor API.
data/config/default.yml CHANGED
@@ -1,7 +1,7 @@
1
1
  # Rabbit information connection
2
2
  rabbit:
3
3
  # Precise RabbitMQ host - Default 'localhost'
4
- host: localhost
4
+ host: rabbit
5
5
  # Precise RabbitMQ port - Default '5672'
6
6
  port: 5672
7
7
  # Precise RabbitMQ vhost - Default '/'
@@ -13,7 +13,7 @@ rabbit:
13
13
  # Password for admin request
14
14
  admin_pass: janusoverlord
15
15
  # Logger level for rabbitmq message
16
- level: info
16
+ level: error
17
17
 
18
18
  # RabbitMQ Queue information
19
19
  queues:
@@ -53,12 +53,12 @@ gem:
53
53
  log:
54
54
  # Define level to log
55
55
  # UNKNOW, FATAL, ERROR, WARN, INFO, DEBUG
56
- level: debug
56
+ level: info
57
57
  # Precise type logger
58
58
  # stdout : Output standard.
59
59
  # file : Create log file in path 'log/ruby-rabbitmq-janus.log'.
60
60
  # remote : Use RemoteSyslogLogger (for papertrail)
61
- type: file
61
+ type: stdout
62
62
  # Used with type. Complete missing data :
63
63
  # stdout : no option
64
64
  # file : filename used
@@ -73,7 +73,7 @@ gem:
73
73
  environment : 'development'
74
74
  # Precise ORM used :
75
75
  # mongoid or active_record
76
- orm: 'mongoid'
76
+ orm: <%= ENV['MONGO'].eql?('true') ? 'mongoid' : 'active_record' %>
77
77
  # Read response json for RSpec
78
78
  response_path: 'spec/supports/rrj/responses'
79
79
  # Number of process read public queue
@@ -34,9 +34,11 @@ module RubyRabbitmqJanus
34
34
  end
35
35
  end
36
36
 
37
- require 'rrj/errors/base/base'
38
37
  require 'rrj/errors/janus/janus'
38
+
39
39
  require 'rrj/errors/process/event'
40
40
  require 'rrj/errors/process/event_admin'
41
+
41
42
  require 'rrj/errors/tools/tools'
43
+
42
44
  require 'rrj/errors/rabbit/rabbit'
@@ -1,17 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'rrj/errors/janus/messages/message'
4
- require 'rrj/errors/janus/messages/admin'
5
- require 'rrj/errors/janus/messages/standard'
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ class BaseJanus < RRJError
6
+ def initialize(klass, message, level = :warn)
7
+ super "[Response][#{klass}] #{message}", level
8
+ end
9
+ end
10
+ end
11
+ end
6
12
 
7
- require 'rrj/errors/janus/responses/base'
8
-
9
- require 'rrj/errors/janus/responses/code'
10
13
  require 'rrj/errors/janus/responses/admin'
14
+ require 'rrj/errors/janus/responses/code'
11
15
  require 'rrj/errors/janus/responses/event'
12
16
  require 'rrj/errors/janus/responses/standard'
13
-
14
- require 'rrj/errors/janus/transactions/transaction'
15
- require 'rrj/errors/janus/transactions/admin'
16
- require 'rrj/errors/janus/transactions/handle'
17
- require 'rrj/errors/janus/transactions/session'
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Admin
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Admin', message
11
11
  end
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Event
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Event', message
11
11
  end
@@ -5,7 +5,7 @@ module RubyRabbitmqJanus
5
5
  module Janus
6
6
  module Responses
7
7
  module Standard
8
- class Base < RubyRabbitmqJanus::Errors::Janus::Responses::Base
8
+ class Base < RubyRabbitmqJanus::Errors::BaseJanus
9
9
  def initialize(message)
10
10
  super 'Standard', message
11
11
  end
@@ -8,19 +8,46 @@ module RubyRabbitmqJanus
8
8
  super "[Rabbit]#{message}", level
9
9
  end
10
10
  end
11
- end
12
- end
13
11
 
14
- require 'rrj/errors/rabbit/base_event'
15
- require 'rrj/errors/rabbit/connect'
16
- require 'rrj/errors/rabbit/propertie'
12
+ module Connect
13
+ # Error when transaction hs no block
14
+ class MissingAction < RubyRabbitmqJanus::Errors::BaseRabbit
15
+ def initialize
16
+ super 'Transaction failed, missing block'
17
+ end
18
+ end
19
+
20
+ # Error When transaction timeout
21
+ class TransactionTimeout < RubyRabbitmqJanus::Errors::BaseRabbit
22
+ def initialize(error)
23
+ super error
24
+ end
25
+ end
26
+ end
27
+
28
+ module Listener
29
+ # Error when response is empty
30
+ class ResponseEmpty < RubyRabbitmqJanus::Errors::BaseRabbit
31
+ def initialize(response)
32
+ super "Response is empty ! (#{response})"
33
+ end
34
+ end
17
35
 
18
- require 'rrj/errors/rabbit/listener/base'
19
- require 'rrj/errors/rabbit/listener/from'
20
- require 'rrj/errors/rabbit/listener/from_admin'
36
+ # Error when response is nil
37
+ class ResponseNil < RubyRabbitmqJanus::Errors::BaseRabbit
38
+ def initialize(response)
39
+ super "Response is nil ! (#{response})"
40
+ end
41
+ end
42
+ end
21
43
 
22
- require 'rrj/errors/rabbit/publisher/base'
23
- require 'rrj/errors/rabbit/publisher/admin'
24
- require 'rrj/errors/rabbit/publisher/exclusive'
25
- require 'rrj/errors/rabbit/publisher/keepalive'
26
- require 'rrj/errors/rabbit/publisher/non_exclusive'
44
+ module Publisher
45
+ # Error when correlation string is not equal
46
+ class TestCorrelation < RubyRabbitmqJanus::Errors::BaseRabbit
47
+ def initialize(message, propertie)
48
+ super "Correlation doesn't equal (msg: #{message}) != (prp: #{propertie})"
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -6,17 +6,53 @@ module RubyRabbitmqJanus
6
6
  # Define a super class for all error in Option class
7
7
  class BaseTools < RRJError
8
8
  def initialize(message, level = :fatal)
9
- super("[Tools]#{message}", level)
9
+ super("[Tools][Config]#{message}", level)
10
+ end
11
+ end
12
+
13
+ module Config
14
+ class QueueFrom < RubyRabbitmqJanus::Errors::Tools::BaseTools
15
+ def initialize
16
+ super '[QueueFrom] Error for reading standard queue from'
17
+ end
18
+ end
19
+
20
+ class QueueTo < RubyRabbitmqJanus::Errors::Tools::BaseTools
21
+ def initialize
22
+ super '[QueueTo] Error for reading standard queue to'
23
+ end
24
+ end
25
+
26
+ class QueueAdminFrom < RubyRabbitmqJanus::Errors::Tools::BaseTools
27
+ def initialize
28
+ super '[QueueAdminFrom] Error for reading admin queue from'
29
+ end
30
+ end
31
+
32
+ class QueueAdminTo < RubyRabbitmqJanus::Errors::Tools::BaseTools
33
+ def initialize
34
+ super '[QueueAdminTo] Error for reading admin queue to'
35
+ end
36
+ end
37
+
38
+ class Plugins < RubyRabbitmqJanus::Errors::Tools::BaseTools
39
+ def initialize
40
+ super "[Plugins] Error for reading plugins at #{index}"
41
+ end
42
+ end
43
+
44
+ class AdminPassword < RubyRabbitmqJanus::Errors::Tools::BaseTools
45
+ def initialize
46
+ super '[AdminPassword] Error for reading option admin password', :warn
47
+ end
48
+ end
49
+
50
+ class Rabbitmq < RubyRabbitmqJanus::Errors::Tools::BaseTools
51
+ def initialize(value)
52
+ super "[RabbitMQConfig] Missing RabbitMQ configuration for key : #{value}", :fatal
53
+ end
10
54
  end
11
55
  end
12
56
  end
13
57
  end
14
58
  end
15
-
16
- require 'rrj/errors/tools/gem/cluster'
17
- require 'rrj/errors/tools/gem/log'
18
- require 'rrj/errors/tools/gem/option'
19
- require 'rrj/errors/tools/gem/request'
20
-
21
- require 'rrj/errors/tools/replaces/replace'
22
- require 'rrj/errors/tools/replaces/type'
data/lib/rrj/info.rb CHANGED
@@ -6,7 +6,7 @@
6
6
  # Define constant to gem.
7
7
  module RubyRabbitmqJanus
8
8
  # Define version to gem
9
- VERSION = '3.0.0'
9
+ VERSION = '4.0.0'
10
10
 
11
11
  # Name to gem
12
12
  GEM_NAME = 'ruby_rabbitmq_janus'
@@ -32,11 +32,9 @@ module RubyRabbitmqJanus
32
32
  #
33
33
  # @return [Hash] Current model
34
34
  #
35
- # rubocop:disable Style/HashTransformValues
36
35
  def unset(attributes)
37
- Hash[attributes.map { |key, _value| [key, nil] }]
36
+ [attributes.map { |key, _value| [key, nil] }].to_h
38
37
  end
39
- # rubocop:enable Style/HashTransformValues
40
38
  end
41
39
  end
42
40
  end
@@ -28,9 +28,9 @@ module RubyRabbitmqJanus
28
28
  @rabbit.transaction_long { transaction_running }
29
29
  rescue Interrupt
30
30
  ::Log.warn "This process has been interupted #{class_name}"
31
- close
32
- else
33
- close
31
+ ::Log.warn \
32
+ "Close a connection with RabbitMQ instance for #{class_name}"
33
+ @rabbit.close
34
34
  end
35
35
 
36
36
  def info_thread
@@ -40,12 +40,6 @@ module RubyRabbitmqJanus
40
40
  def class_name
41
41
  self.class.name
42
42
  end
43
-
44
- def close
45
- ::Log.warn \
46
- "Close a connection with RabbitMQ instance for #{class_name}"
47
- @rabbit.close
48
- end
49
43
  end
50
44
  end
51
45
  end
@@ -15,7 +15,7 @@ module RubyRabbitmqJanus
15
15
 
16
16
  # Create an transaction with rabbitmq and close after response is received
17
17
  def transaction_short(&block)
18
- raise Errors::Rabbit::Connect::MissingAction unless block
18
+ raise RubyRabbitmqJanus::Errors::Connect::MissingAction unless block
19
19
 
20
20
  response = nil
21
21
 
@@ -23,7 +23,8 @@ module RubyRabbitmqJanus
23
23
  response = transaction_long(&block)
24
24
  end
25
25
  rescue Timeout::Error
26
- ::Log.error 'The "Short transaction" have raised Timeout exception.'
26
+ raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
27
+ 'The "Short transaction" have raised Timeout exception.'
27
28
  ensure
28
29
  close
29
30
  response
@@ -31,14 +32,15 @@ module RubyRabbitmqJanus
31
32
 
32
33
  # Create an transaction with rabbitmq and not close
33
34
  def transaction_long
34
- raise Errors::Rabbit::Connect::MissingAction unless block_given?
35
+ raise RubyRabbitmqJanus::Errors::Connect::MissingAction unless block_given?
35
36
 
36
- Timeout.timeout(10) do
37
+ Timeout.timeout(60) do
37
38
  start
38
39
  yield
39
40
  end
40
41
  rescue Timeout::Error
41
- ::Log.error 'The "Long transaction" have raised Timeout exception.'
42
+ raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
43
+ 'The "Long transaction" have raised Timeout exception.'
42
44
  end
43
45
 
44
46
  # Opening a connection with RabbitMQ
@@ -34,7 +34,7 @@ module RubyRabbitmqJanus
34
34
 
35
35
  # Define HOME RRJ gem
36
36
  RRJ_HOME = File.realpath(File.join(File.dirname(__FILE__),
37
- '..', '..', '..'))
37
+ '..', '..', '..', '..'))
38
38
 
39
39
  # Define a default name to file configuration
40
40
  CONF_DEFAULT = 'config/default.yml'
@@ -12,7 +12,7 @@ module RubyRabbitmqJanus
12
12
  module ConfigGem
13
13
  # @return [Boolean] Read option file for a janus cluster section
14
14
  def cluster
15
- @options['gem']['cluster']['enabled'].to_s.match?('true')
15
+ @options['gem']['cluster']['enabled'].to_s.match?('true') || false
16
16
  end
17
17
 
18
18
  # @return [Symbol] read configuration for log level used in this gem
@@ -19,6 +19,8 @@ module RubyRabbitmqJanus
19
19
  # @return [String] read configuration for plugin with index
20
20
  def plugin_at(index = 0)
21
21
  @options['janus']['plugins'][index].to_s
22
+ rescue
23
+ raise RubyRabbitmqJanus::Errors::Tools::Plugins, index
22
24
  end
23
25
 
24
26
  alias ttl time_to_live
@@ -11,21 +11,29 @@ module RubyRabbitmqJanus
11
11
  # @return [String] Get to name queue_from (pattern)
12
12
  def queue_from
13
13
  @options['queues']['standard']['from'].to_s
14
+ rescue
15
+ raise RubyRabbitmqJanus::Errors::Tools::QueueFrom
14
16
  end
15
17
 
16
18
  # @return [String] Get to name queue_to (pattern)
17
19
  def queue_to
18
20
  @options['queues']['standard']['to'].to_s
21
+ rescue
22
+ raise RubyRabbitmqJanus::Errors::Tools::QueueTo
19
23
  end
20
24
 
21
25
  # @return [String] Get to name queue_admin_from (pattern)
22
26
  def queue_admin_from
23
27
  @options['queues']['admin']['from'].to_s
28
+ rescue
29
+ raise RubyRabbitmqJanus::Errors::Tools::QueueAdminFrom
24
30
  end
25
31
 
26
32
  # @return [String] Get to name queue_admin_from (pattern)
27
33
  def queue_admin_to
28
34
  @options['queues']['admin']['to'].to_s
35
+ rescue
36
+ raise RubyRabbitmqJanus::Errors::Tools::QueueAdminTo
29
37
  end
30
38
  end
31
39
  end
@@ -13,6 +13,8 @@ module RubyRabbitmqJanus
13
13
  # @return [String] read configuration fir queue admin
14
14
  def admin_pass
15
15
  @options['rabbit']['admin_pass'].to_s
16
+ rescue
17
+ raise RubyRabbitmqJanus::Errors::Tools::AdminPassword
16
18
  end
17
19
 
18
20
  # @return [Symbol] read configuration for bunny log level
@@ -56,11 +56,11 @@ module RubyRabbitmqJanus
56
56
  end
57
57
 
58
58
  def rewrite_key_to_string(node)
59
- Hash[
59
+ [
60
60
  node.map do |key, value|
61
61
  [key.to_s, value?(value)]
62
62
  end
63
- ]
63
+ ].to_h
64
64
  end
65
65
 
66
66
  def value?(value)
@@ -6,3 +6,4 @@ adapter: sqlite3
6
6
  encoding: utf-8
7
7
  database: ':memory:'
8
8
  timeout: 5000
9
+ pool: 5