ruby_rabbitmq_janus 2.5.1 → 2.6.0.pre.226

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/ruby_rabbitmq_janus +67 -0
  4. data/config/default.md +3 -0
  5. data/config/default.yml +6 -0
  6. data/lib/rrj/binary.rb +56 -0
  7. data/lib/rrj/errors/rabbit/base_event.rb +21 -0
  8. data/lib/rrj/errors/rabbit/listener/base.rb +29 -0
  9. data/lib/rrj/errors/rabbit/listener/from.rb +17 -0
  10. data/lib/rrj/errors/rabbit/listener/from_admin.rb +17 -0
  11. data/lib/rrj/errors/rabbit/listener/janus_instance.rb +17 -0
  12. data/lib/rrj/errors/rabbit/publisher/admin.rb +32 -0
  13. data/lib/rrj/errors/rabbit/publisher/base.rb +31 -0
  14. data/lib/rrj/errors/rabbit/publisher/exclusive.rb +33 -0
  15. data/lib/rrj/errors/rabbit/publisher/janus_instance.rb +23 -0
  16. data/lib/rrj/errors/rabbit/publisher/keepalive.rb +17 -0
  17. data/lib/rrj/errors/rabbit/publisher/non_exclusive.rb +33 -0
  18. data/lib/rrj/errors/rabbit/rabbit.rb +12 -6
  19. data/lib/rrj/info.rb +6 -5
  20. data/lib/rrj/init.rb +2 -2
  21. data/lib/rrj/janus/messages/message.rb +1 -1
  22. data/lib/rrj/janus/processus/event.rb +1 -1
  23. data/lib/rrj/janus/processus/keepalive/keepalive_thread.rb +3 -2
  24. data/lib/rrj/janus/responses/janus_instance.rb +28 -0
  25. data/lib/rrj/janus/responses/response.rb +1 -1
  26. data/lib/rrj/janus/transactions/admin.rb +1 -1
  27. data/lib/rrj/janus/transactions/handle.rb +1 -1
  28. data/lib/rrj/janus/transactions/transaction.rb +2 -2
  29. data/lib/rrj/models/concerns/janus_instance_callbacks.rb +9 -5
  30. data/lib/rrj/models/concerns/janus_instance_methods.rb +12 -0
  31. data/lib/rrj/rabbit/base_event.rb +47 -0
  32. data/lib/rrj/rabbit/connect.rb +12 -12
  33. data/lib/rrj/rabbit/{publish/listener.rb → listener/base.rb} +16 -18
  34. data/lib/rrj/rabbit/listener/from.rb +30 -0
  35. data/lib/rrj/rabbit/{publish/listener_admin.rb → listener/from_admin.rb} +6 -4
  36. data/lib/rrj/rabbit/listener/janus_instance.rb +36 -0
  37. data/lib/rrj/rabbit/{publish/publisher_admin.rb → publisher/admin.rb} +5 -10
  38. data/lib/rrj/rabbit/{publish/publisher.rb → publisher/base.rb} +10 -8
  39. data/lib/rrj/rabbit/{publish → publisher}/exclusive.rb +3 -3
  40. data/lib/rrj/rabbit/publisher/janus_instance.rb +27 -0
  41. data/lib/rrj/rabbit/{publish → publisher}/keepalive.rb +4 -2
  42. data/lib/rrj/rabbit/{publish → publisher}/non_exclusive.rb +3 -7
  43. data/lib/rrj/rabbit/rabbit.rb +1 -1
  44. data/lib/rrj/tools/gem/cluster.rb +0 -17
  45. data/lib/rrj/tools/gem/config.rb +9 -0
  46. data/lib/rrj/tools/gem/log.rb +3 -4
  47. data/lib/rrj/tools/gem/option.rb +2 -12
  48. data/lib/rrj/tools/replaces/admin.rb +4 -4
  49. data/lib/rrj/tools/replaces/handle.rb +6 -6
  50. data/lib/rrj/tools/replaces/replace.rb +6 -6
  51. data/lib/rrj/tools/replaces/session.rb +4 -4
  52. data/spec/factories/janus_instance.rb +1 -1
  53. data/spec/request/admin/request_allow_token_spec.rb +1 -0
  54. data/spec/request/admin/request_disallow_token_spec.rb +1 -0
  55. data/spec/request/admin/request_handle_info_spec.rb +1 -0
  56. data/spec/request/admin/request_list_handles_spec.rb +1 -0
  57. data/spec/request/admin/request_list_sessions_spec.rb +1 -0
  58. data/spec/request/admin/request_start_pcap_spec.rb +1 -0
  59. data/spec/request/admin/request_start_text2pcap_spec.rb +1 -0
  60. data/spec/request/admin/request_stop_pcap_spec.rb +1 -0
  61. data/spec/request/admin/request_stop_text2pcap_spec.rb +1 -0
  62. data/spec/request/base/request_attach_spec.rb +1 -1
  63. data/spec/request/base/request_create_spec.rb +2 -2
  64. data/spec/request/base/request_destroy_spec.rb +1 -1
  65. data/spec/request/base/request_detach_spec.rb +1 -1
  66. data/spec/request/base/request_info_spec.rb +2 -2
  67. data/spec/request/base/request_keepalive_spec.rb +1 -1
  68. data/spec/request/peer/request_offer_spec.rb +1 -1
  69. data/spec/request/peer/request_trickle_spec.rb +1 -1
  70. data/spec/request/peer/request_trickles_spec.rb +1 -1
  71. data/spec/rrj/{rrj_spec.rb → ruby_rabbitmq_janus_spec.rb} +21 -11
  72. data/spec/{thread/concurencies_spec.rb → ruby_rabbitmq_janus/janus/concurrencies/concurrency_spec.rb} +1 -1
  73. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_initializer_spec.rb +3 -2
  74. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_thread_spec.rb +3 -3
  75. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_timer_spec.rb +1 -1
  76. data/spec/{rrj/messages/messages_admin_spec.rb → ruby_rabbitmq_janus/janus/messages/admin_spec.rb} +1 -1
  77. data/spec/{rrj/messages/messages_message_spec.rb → ruby_rabbitmq_janus/janus/messages/message_spec.rb} +2 -1
  78. data/spec/{rrj/messages/messages_standard_spec.rb → ruby_rabbitmq_janus/janus/messages/standard_spec.rb} +1 -1
  79. data/spec/{rrj/responses/responses_admin_spec.rb → ruby_rabbitmq_janus/janus/responses/admin_spec.rb} +1 -1
  80. data/spec/{rrj/responses/responses_event_spec.rb → ruby_rabbitmq_janus/janus/responses/event_spec.rb} +3 -2
  81. data/spec/{rrj/responses/responses_response_spec.rb → ruby_rabbitmq_janus/janus/responses/response_spec.rb} +3 -3
  82. data/spec/{rrj/responses/responses_standard_spec.rb → ruby_rabbitmq_janus/janus/responses/standard_spec.rb} +4 -3
  83. data/spec/{rrj → ruby_rabbitmq_janus}/models/janus_instance_definition_spec.rb +2 -2
  84. data/spec/{rrj/models/janus_instance_transaction_spec.rb → ruby_rabbitmq_janus/models/janus_instance_spec.rb} +10 -9
  85. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/connect_spec.rb +1 -1
  86. data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +15 -0
  87. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_2_spec.rb +3 -3
  88. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_spec.rb +3 -3
  89. data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +12 -0
  90. data/spec/{rrj/rabbit/publish/base_publisher_spec.rb → ruby_rabbitmq_janus/rabbit/publisher/base_spec.rb} +3 -3
  91. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/exclusive_spec.rb +0 -0
  92. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/non_exclusive_spec.rb +0 -0
  93. data/spec/{rrj/tools/gem/rrj_cluster_spec.rb → ruby_rabbitmq_janus/tools/cluster_spec.rb} +1 -21
  94. data/spec/{rrj/tools/gem/rrj_config_spec.rb → ruby_rabbitmq_janus/tools/config_spec.rb} +26 -14
  95. data/spec/{rrj/tools/gem/rrj_log_spec.rb → ruby_rabbitmq_janus/tools/log_spec.rb} +10 -10
  96. data/spec/{rrj/tools/replace/replace_admin_spec.rb → ruby_rabbitmq_janus/tools/replaces/admin_spec.rb} +15 -15
  97. data/spec/{rrj/tools/replace/replace_handle_spec.rb → ruby_rabbitmq_janus/tools/replaces/handle_spec.rb} +14 -14
  98. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools/replaces}/replace_spec.rb +16 -17
  99. data/spec/{rrj/tools/replace/replace_session_spec.rb → ruby_rabbitmq_janus/tools/replaces/session_spec.rb} +14 -14
  100. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools}/type_spec.rb +19 -19
  101. data/spec/spec_helper.rb +1 -1
  102. data/spec/support/examples_request.rb +1 -1
  103. data/spec/support/type.rb +3 -3
  104. metadata +83 -59
  105. data/lib/rrj/errors/rabbit/publish/admin.rb +0 -30
  106. data/lib/rrj/errors/rabbit/publish/base_publisher.rb +0 -23
  107. data/lib/rrj/errors/rabbit/publish/exclusive.rb +0 -31
  108. data/lib/rrj/errors/rabbit/publish/listener.rb +0 -30
  109. data/lib/rrj/errors/rabbit/publish/non_exclusive.rb +0 -31
  110. data/lib/rrj/errors/rabbit/publish/publisher.rb +0 -38
  111. data/lib/rrj/rabbit/publish/base_publisher.rb +0 -50
  112. data/spec/rrj/rabbit/publish/admin_spec.rb +0 -12
  113. data/spec/rrj/rabbit/publish/listener_spec.rb +0 -15
  114. data/spec/rrj/rabbit/publish/publisher_spec.rb +0 -13
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rrj/janus/responses/janus_instance'
4
+
5
+ module RubyRabbitmqJanus
6
+ module Rabbit
7
+ module Listener
8
+ # Listener to admin queue
9
+ class JanusInstance < From
10
+ private
11
+
12
+ def subscribe_queue
13
+ reply = @rabbit.queue(Tools::Config.instance.queue_janus_instance)
14
+ @rabbit.prefetch(1)
15
+ reply.bind(binding).subscribe(opts_subs) do |info, prop, payload|
16
+ info_subscribe(info, prop, payload)
17
+ synchronize_response(info, payload)
18
+ end
19
+ rescue => exception
20
+ raise RubyRabbitmqJanus::Errors::Rabbit::Listener::
21
+ JanusInstance::ListenEvents, exception
22
+ end
23
+
24
+ # Sending an signal when an response is reading in queue
25
+ def synchronize_response(info, payload)
26
+ lock.synchronize do
27
+ response = Janus::Responses::JanusInstance.new(JSON.parse(payload))
28
+ @responses.push(response)
29
+ end
30
+ @rabbit.acknowledge(info.delivery_tag, false)
31
+ semaphore.signal
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
@@ -1,14 +1,12 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # :reek:InstanceVariableAssumption
4
-
5
3
  module RubyRabbitmqJanus
6
4
  module Rabbit
7
5
  module Publisher
8
6
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
9
7
  # This publisher send and read an message in admin queues
10
- class PublisherAdmin < Publisher
11
- # Intialize an queue non eclusive for admin/monitor API with Janus
8
+ class Admin < Base
9
+ # Initialize an queue non eclusive for admin/monitor API with Janus
12
10
  #
13
11
  # @param [String] exchange Exchange used for the transaction
14
12
  def initialize(exchange)
@@ -17,11 +15,12 @@ module RubyRabbitmqJanus
17
15
  super(exchange)
18
16
  subscribe_to_queue
19
17
  rescue
20
- raise Errors::Rabbit::PublisherAdmin::Initialize
18
+ raise Errors::Rabbit::Publisher::Admin::Initialize
21
19
  end
22
20
 
23
21
  # Send an message to queue and waiting a response
24
22
  #
23
+ #
25
24
  # @param [String] request JSON request sending to rabbitmq queue
26
25
  #
27
26
  # @return [Janus::Response::Admin] response for an request reading
@@ -32,12 +31,8 @@ module RubyRabbitmqJanus
32
31
  request.options.merge!(reply_to: reply.name))
33
32
  return_response
34
33
  rescue
35
- raise Errors::Rabbit::PublisherAdmin::Pusblish
34
+ raise Errors::Rabbit::Publisher::Admin::Pusblish
36
35
  end
37
-
38
- private
39
-
40
- attr_reader :reply
41
36
  end
42
37
  end
43
38
  end
@@ -8,7 +8,7 @@ module RubyRabbitmqJanus
8
8
  # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
9
9
  #
10
10
  # This publisher send and read an message in queues
11
- class Publisher < BasePublisher
11
+ class Base < RubyRabbitmqJanus::Rabbit::BaseEvent
12
12
  # Intialize a publisher for sending and reading a message
13
13
  #
14
14
  # @param [String] exchange Determine type exchange used for all
@@ -18,7 +18,7 @@ module RubyRabbitmqJanus
18
18
  @exchange = exchange.default_exchange
19
19
  @message = nil
20
20
  rescue
21
- raise Errors::Rabbit::Publish::Initialize
21
+ raise Errors::Rabbit::Publisher::Base::Initialize
22
22
  end
23
23
 
24
24
  # Publish an message in queue
@@ -32,7 +32,7 @@ module RubyRabbitmqJanus
32
32
  @exchange.publish(@message.to_json,
33
33
  request.options.merge!(reply_to: reply.name))
34
34
  rescue
35
- raise Errors::Rabbit::Publish::Publish
35
+ raise Errors::Rabbit::Publisher::Base::Publish
36
36
  end
37
37
 
38
38
  private
@@ -57,7 +57,7 @@ module RubyRabbitmqJanus
57
57
  if m_cor.eql?(p_cor)
58
58
  yield
59
59
  else
60
- raise Errors::Rabbit::Publish::TestCorrelation, m_cor, p_cor
60
+ raise Errors::Rabbit::Publisher::Base::TestCorrelation, m_cor, p_cor
61
61
  end
62
62
  end
63
63
 
@@ -69,13 +69,15 @@ module RubyRabbitmqJanus
69
69
  end
70
70
 
71
71
  attr_accessor :message
72
+ attr_reader :reply
72
73
  end
73
74
  end
74
75
  end
75
76
  end
76
77
  # rubocop:enable Style/GuardClause
77
78
 
78
- require 'rrj/rabbit/publish/publisher_admin'
79
- require 'rrj/rabbit/publish/exclusive'
80
- require 'rrj/rabbit/publish/keepalive'
81
- require 'rrj/rabbit/publish/non_exclusive'
79
+ require 'rrj/rabbit/publisher/exclusive'
80
+ require 'rrj/rabbit/publisher/admin'
81
+ require 'rrj/rabbit/publisher/keepalive'
82
+ require 'rrj/rabbit/publisher/non_exclusive'
83
+ require 'rrj/rabbit/publisher/janus_instance'
@@ -9,7 +9,7 @@ module RubyRabbitmqJanus
9
9
  #
10
10
  # Publish message in queue exclusive. Bunny create automaticaly a name for
11
11
  # this queue. The queue name like to 'amq.gen-1A456DGVHDVUS'.
12
- class PublishExclusive < Publisher
12
+ class Exclusive < Base
13
13
  # Initialize an queue exclusive and generated automaticaly by bunny
14
14
  #
15
15
  # @param [String] exchange Exchange used for the transaction
@@ -19,7 +19,7 @@ module RubyRabbitmqJanus
19
19
  super(exchange)
20
20
  subscribe_to_queue
21
21
  rescue
22
- raise Errors::Rabbit::PublishExclusive::Initialize
22
+ raise Errors::Rabbit::Publisher::Exclusive::Initialize
23
23
  end
24
24
 
25
25
  # Send an message to queue and waiting a response
@@ -32,7 +32,7 @@ module RubyRabbitmqJanus
32
32
  super(request)
33
33
  return_response
34
34
  rescue
35
- raise Errors::Rabbit::PublishExclusive::Publish
35
+ raise Errors::Rabbit::Publisher::Exclusive::Publish
36
36
  end
37
37
 
38
38
  private
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Rabbit
5
+ module Publisher
6
+ # Publisher to queue `janus-instance`
7
+ class JanusInstance
8
+ def initialize
9
+ @rabbit = RubyRabbitmqJanus::Rabbit::Connect.new
10
+ rescue
11
+ raise Errors::Rabbit::Publisher::JanusInstance::Initialize
12
+ end
13
+
14
+ def publish(data)
15
+ @rabbit.start
16
+ channel = @rabbit.channel
17
+ queue = channel.queue(Tools::Config.instance.queue_janus_instance)
18
+ channel.default_exchange.publish(data.to_json,
19
+ routing_key: queue.name)
20
+ @rabbit.close
21
+ rescue
22
+ raise Errors::Rabbit::Publisher::JanusInstance::Publish
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -10,18 +10,20 @@ module RubyRabbitmqJanus
10
10
  # The name to queue it's created automatically by Bunny GEM
11
11
  #
12
12
  # @see KeepaliveThread
13
- class PublishKeepalive < Publisher
13
+ class Keepalive < Base
14
14
  def initialize(exchange)
15
15
  @reply = exchange.queue('', exclusive: true)
16
16
  super(exchange)
17
17
  subscribe_to_queue
18
+ rescue
19
+ raise Errors::Rabbit::Publisher::Keepalive::Initialize
18
20
  end
19
21
 
20
22
  def publish(request)
21
23
  super(request)
22
24
  return_response
23
25
  rescue
24
- raise Errors::Rabbit::PublishExclusive::Publish
26
+ raise Errors::Rabbit::Publisher::Keepalive::Publish
25
27
  end
26
28
 
27
29
  private
@@ -7,13 +7,13 @@ module RubyRabbitmqJanus
7
7
  #
8
8
  # Publish message in queue non exclusive. By default "to-janus".
9
9
  # This an option in config to this gem.
10
- class PublishNonExclusive < Publisher
10
+ class NonExclusive < Base
11
11
  # Define an publisher for create non exclusive queue
12
12
  def initialize(exchange)
13
13
  @reply = exchange.queue(Tools::Config.instance.queue_from)
14
14
  super(exchange)
15
15
  rescue
16
- raise Errors::Rabbit::PublishNonExclusive::Initialize
16
+ raise Errors::Rabbit::Publisher::NonExclusive::Initialize
17
17
  end
18
18
 
19
19
  # Send an message to queue
@@ -22,12 +22,8 @@ module RubyRabbitmqJanus
22
22
  def publish(request)
23
23
  super(request)
24
24
  rescue
25
- raise Errors::Rabbit::PublishNonExclusive::Publish
25
+ raise Errors::Rabbit::Publisher::NonExclusive::Publish
26
26
  end
27
-
28
- private
29
-
30
- attr_reader :reply
31
27
  end
32
28
  end
33
29
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'rrj/rabbit/connect'
4
- require 'rrj/rabbit/publish/base_publisher'
4
+ require 'rrj/rabbit/base_event'
5
5
  require 'rrj/rabbit/propertie'
6
6
 
7
7
  module RubyRabbitmqJanus
@@ -13,23 +13,6 @@ module RubyRabbitmqJanus
13
13
  @current_instance = nil
14
14
  end
15
15
 
16
- # Create session (just one Janus Instance)
17
- def create_session
18
- @current_instance = 1
19
- Models::JanusInstance.create(instance: @current_instance)
20
- rescue
21
- raise Errors::Tools::Cluster::CreateSession
22
- end
23
-
24
- # Restart a thread keepalive for an instance
25
- def restart_session
26
- Models::JanusInstance.enabled.each do |ji|
27
- ji.send(:create_a_session_in_janus_instance)
28
- end
29
- rescue
30
- raise Errors::Tools::Cluster::RestartInstance
31
- end
32
-
33
16
  # Specify a name to queue
34
17
  def queue_to(instance = nil)
35
18
  Tools::Config.instance.options['queues']['standard']['to'] + \
@@ -76,6 +76,15 @@ module RubyRabbitmqJanus
76
76
  raise Errors::Tools::Config::QueueAdminTo
77
77
  end
78
78
 
79
+ # Get to name queue JanusInstance
80
+ #
81
+ # @return [String] read configuration for queue janus instance
82
+ def queue_janus_instance
83
+ @options['queues']['instance'].to_s
84
+ rescue
85
+ raise Errors::Tools::Config::QueueJanusInstance
86
+ end
87
+
79
88
  # @return [Symbol] read configuration for log level used in this gem
80
89
  def log_level
81
90
  @options['gem']['log']['level'].upcase.to_sym || :INFO
@@ -23,7 +23,7 @@ module RubyRabbitmqJanus
23
23
  UNKNOWN: Logger::UNKNOWN
24
24
  }.freeze
25
25
 
26
- # Sensitive data
26
+ # Sensitive data hiding to logger
27
27
  SENSITIVES = %i[admin_secret apisecret].freeze
28
28
 
29
29
  attr_reader :level
@@ -34,11 +34,10 @@ module RubyRabbitmqJanus
34
34
  # @see http://api.rubyonrails.org/classes/ActiveSupport/TaggedLogging.html
35
35
  def initialize
36
36
  logs = defined?(Rails) ? logger_rails : logger_develop
37
- logs.progname = RubyRabbitmqJanus.name
37
+ logs.progname = 'RRJ' if ENV['PROGRAM_NAME'].eql?('ruby_rabbitmq_janus')
38
38
  logs.level = LEVELS[:DEBUG]
39
- logs.info('### Start gem Rails Rabbit Janus ###')
39
+ logs.info('### Start gem Ruby Rabbit Janus ###')
40
40
  @level = logs.level
41
- @progname = logs.progname
42
41
  @logs = ActiveSupport::TaggedLogging.new(logs)
43
42
  end
44
43
 
@@ -20,9 +20,8 @@ module RubyRabbitmqJanus
20
20
  Log.instance
21
21
  Config.instance
22
22
  Requests.instance
23
- cluster_mode
24
- rescue => error
25
- raise Errors::Tools::Option::Initialize, error
23
+ rescue => exception
24
+ raise Errors::Tools::Option::Initialize, exception
26
25
  end
27
26
 
28
27
  # Determine session_id used
@@ -54,15 +53,6 @@ module RubyRabbitmqJanus
54
53
  rescue
55
54
  raise Errors::Tools::Option::UseCurrentHandle, options
56
55
  end
57
-
58
- private
59
-
60
- def cluster_mode
61
- method = Config.instance.cluster ? :restart_session : :create_session
62
- Cluster.instance.send(method)
63
- rescue
64
- raise Errors::Tools::Option::ClusterMode
65
- end
66
56
  end
67
57
  end
68
58
  end
@@ -42,14 +42,14 @@ module RubyRabbitmqJanus
42
42
 
43
43
  def replace_component(key)
44
44
  request[key] = type.convert(key, opts)
45
- rescue => message
46
- Tools::Log.instance.warn "Error replace #{key} : #{message}"
45
+ rescue => exception
46
+ Tools::Log.instance.warn "Error replace #{key} : #{exception}"
47
47
  end
48
48
 
49
49
  def replace_admin
50
50
  request['admin_secret'] = admin_pass
51
- rescue => message
52
- Tools::Log.instance.warn "Error replace admin_secret : #{message}"
51
+ rescue => exception
52
+ Tools::Log.instance.warn "Error replace admin_secret : #{exception}"
53
53
  end
54
54
 
55
55
  def admin_pass
@@ -20,22 +20,22 @@ module RubyRabbitmqJanus
20
20
 
21
21
  def replace_handle
22
22
  request['handle_id'] = type.convert('handle_id', opts)
23
- rescue => message
24
- Tools::Log.instance.warn "Error handle replace : #{message}"
23
+ rescue => exception
24
+ Tools::Log.instance.warn "Error handle replace : #{exception}"
25
25
  end
26
26
 
27
27
  def replace_candidate
28
28
  cdn = type.convert(determine_key_candidate, opts)
29
29
  request[cdn[0]] = cdn[1]
30
30
  delete_key_unless
31
- rescue => message
32
- Tools::Log.instance.warn "Error candidate replace : #{message}"
31
+ rescue => exception
32
+ Tools::Log.instance.warn "Error candidate replace : #{exception}"
33
33
  end
34
34
 
35
35
  def replace_sdp
36
36
  request['jsep']['sdp'] = type.convert('sdp', opts)
37
- rescue => message
38
- Tools::Log.instance.warn "Error sdp replace : #{message}"
37
+ rescue => exception
38
+ Tools::Log.instance.warn "Error sdp replace : #{exception}"
39
39
  end
40
40
 
41
41
  def determine_key_candidate
@@ -50,15 +50,15 @@ module RubyRabbitmqJanus
50
50
  def replace_other
51
51
  values = @opts['replace']
52
52
  running_hash(rewrite_key_to_string(values))
53
- rescue => message
54
- Tools::Log.instance.warn "Error REPLACE other field : #{message}"
53
+ rescue => exception
54
+ Tools::Log.instance.warn "Error REPLACE other field : #{exception}"
55
55
  end
56
56
 
57
57
  def add_other
58
58
  values = @opts['add']
59
59
  @request['body'].merge!(values)
60
- rescue => message
61
- Tools::Log.instance.warn "Error ADD other field : #{message}"
60
+ rescue => exception
61
+ Tools::Log.instance.warn "Error ADD other field : #{exception}"
62
62
  end
63
63
 
64
64
  def rewrite_key_to_string(node)
@@ -93,8 +93,8 @@ module RubyRabbitmqJanus
93
93
 
94
94
  def replace_transaction
95
95
  @request['transaction'] = @type.convert('transaction')
96
- rescue => message
97
- Tools::Log.instance.warn "Error transaction replace : #{message}"
96
+ rescue => exception
97
+ Tools::Log.instance.warn "Error transaction replace : #{exception}"
98
98
  end
99
99
  end
100
100
  end
@@ -19,14 +19,14 @@ module RubyRabbitmqJanus
19
19
 
20
20
  def replace_session
21
21
  request['session_id'] = type.convert('session_id', opts)
22
- rescue => message
23
- Tools::Log.instance.warn "Error session replace : #{message}"
22
+ rescue => exception
23
+ Tools::Log.instance.warn "Error session replace : #{exception}"
24
24
  end
25
25
 
26
26
  def replace_plugin
27
27
  request['plugin'] = type.convert('plugin')
28
- rescue => message
29
- Tools::Log.instance.warn "Error plugin replace : #{message}"
28
+ rescue => exception
29
+ Tools::Log.instance.warn "Error plugin replace : #{exception}"
30
30
  end
31
31
  end
32
32
  end