ruby_rabbitmq_janus 3.0.0.pre.334 → 3.0.0.pre.335

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: dab52d2ea0ff5412d2747cc0a35d0f5ad2d4e39fbe5080df7f7b6909781d152e
4
- data.tar.gz: 673e03c92bd18201acc0d25eb001dc0f9876b654991c4111229bebf154f53b41
3
+ metadata.gz: c3fe2a3db13d059388205ab8b00b1abf9d3f2df69b6cd4429de351bdfcaa84fa
4
+ data.tar.gz: 6f744f5aeb97d5b6983d95e4016a9665969d5c97de9f2def000d60e69d7fc005
5
5
  SHA512:
6
- metadata.gz: 9034e88142324ef2de0aaee27db832d80fff227fe62e31c06eef8c72ca73f4f152632e5c472118368a74b54a1e02bc64844b5db7201ad2b1e8899fda03c3f328
7
- data.tar.gz: '068051edf6efdcaf97658f503bb4c6f86463e0483398b61e49b0f0e8af5187d551f7876a31c874e7b92ca96f508260caaab33dc5170ecdc0cde3fb065303aee2'
6
+ metadata.gz: d2019a5c5a40a2ec666f07c293daad9eacae6727a1b0fad53c3d36bdcc1b62ffa5fe510ab65d836aa8e5c197c3e48361c8a33de6b4966b32cfea1a5db42e8b88
7
+ data.tar.gz: bc5a22eab7f07b5b3d8bc7b448787902ccf7fe2ea074bb63eda0d6d11d80eeb1da7dd61e1525079befb1c4516c40f0ca60fb8e96df95cdb3210c9f4efd6d304f
@@ -10,6 +10,13 @@ module RubyRabbitmqJanus
10
10
  end
11
11
  end
12
12
 
13
+ # Define a super class for all error in Process::Concurency::Event class
14
+ class BaseEvent < RubyRabbitmqJanus::Errors::Process::BaseConcurency
15
+ def initialize(class_name, message)
16
+ super "[#{class_name}] #{message}"
17
+ end
18
+ end
19
+
13
20
  module Concurency
14
21
  # Error for Process::Concurency#initialize
15
22
  class Initializer < RubyRabbitmqJanus::Errors::Process::BaseConcurency
@@ -22,5 +29,5 @@ module RubyRabbitmqJanus
22
29
  end
23
30
  end
24
31
 
25
- require 'rrj/errors/process/keepalive'
26
32
  require 'rrj/errors/process/event'
33
+ require 'rrj/errors/process/event_admin'
@@ -3,25 +3,18 @@
3
3
  module RubyRabbitmqJanus
4
4
  module Errors
5
5
  module Process
6
- # Define a super class for all error in Process::Concurency::Event class
7
- class BaseEvent < RubyRabbitmqJanus::Errors::Process::BaseConcurency
8
- def initialize(message)
9
- super "[Event] #{message}"
10
- end
11
- end
12
-
13
6
  module Event
14
- # Error for Process::Concurency::Event#initialize
7
+ # Error for Process::Concurrencies::Event#initialize
15
8
  class Initializer < RubyRabbitmqJanus::Errors::Process::BaseEvent
16
9
  def initializer
17
- super 'Error Event initializer'
10
+ super 'Event', 'Error Event initializer'
18
11
  end
19
12
  end
20
13
 
21
- # Error for Process::Concurency::Event#run
14
+ # Error for Process::Concurrencies::Event#run
22
15
  class Run < RubyRabbitmqJanus::Errors::Process::BaseEvent
23
16
  def initializer
24
- super 'Error running block code'
17
+ super 'Event', 'Error Event runner block code'
25
18
  end
26
19
  end
27
20
  end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Process
6
+ module EventAdmin
7
+ # Error for Process::Concurrencies::EventAdmin#initialize
8
+ class Initializer < RubyRabbitmqJanus::Errors::Process::BaseEvent
9
+ def initializer
10
+ super 'EventAdmin', 'Error EventAdmin initializer'
11
+ end
12
+ end
13
+
14
+ # Error for Process::Concurrencies::EventAdmin#run
15
+ class Run < RubyRabbitmqJanus::Errors::Process::BaseEvent
16
+ def initializer
17
+ super 'EventAdmin', 'Error EventAdmin runner block code'
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,11 +1,10 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # :reek:IrresponsibleModule
4
-
5
3
  module RubyRabbitmqJanus
6
4
  module Errors
7
5
  module Rabbit
8
6
  module Listener
7
+ # Base class error for listeners
9
8
  class BaseError < BaseRabbit
10
9
  def initialize(message, level = :fatal)
11
10
  super("[Listener] #{message}", level)
@@ -13,15 +12,24 @@ module RubyRabbitmqJanus
13
12
  end
14
13
 
15
14
  module Base
15
+ # Error initializer for listeners
16
16
  class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
17
17
  def initialize
18
18
  super 'Error in initialize'
19
19
  end
20
20
  end
21
21
 
22
+ # Error listen event
22
23
  class ListenEvents < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
23
- def initialize
24
- super "Error when listen events to queue 'janus-instance-thread'"
24
+ def initialize(queue)
25
+ super "Error when listen events to queue '#{queue}'"
26
+ end
27
+ end
28
+
29
+ # Error when response is read by a listener
30
+ class ResponseEmpty < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
31
+ def initialize(response)
32
+ super "Response is empty ! (#{response})"
25
33
  end
26
34
  end
27
35
  end
@@ -56,12 +56,6 @@ module RubyRabbitmqJanus
56
56
  end
57
57
  end
58
58
 
59
- class RabbitTester < RubyRabbitmqJanus::Errors::Tools::BaseConfig
60
- def initialize
61
- super '[RabbitTester] Error for reading option rabbitmq tester', :warn
62
- end
63
- end
64
-
65
59
  class AdminPassword < RubyRabbitmqJanus::Errors::Tools::BaseConfig
66
60
  def initialize
67
61
  super '[AdminPassword] Error for reading option admin password', :warn
@@ -115,6 +109,12 @@ module RubyRabbitmqJanus
115
109
  super '[ProgramName] Error with ProgramName option', :fatal
116
110
  end
117
111
  end
112
+
113
+ class Rabbitmq < RubyRabbitmqJanus::Errors::Tools::BaseConfig
114
+ def initialize(value)
115
+ super "[RabbitMQConfig] Missing RabbitMQ configuration for key : #{value}", :fatal
116
+ end
117
+ end
118
118
  end
119
119
  end
120
120
  end
@@ -18,7 +18,7 @@ module RubyRabbitmqJanus
18
18
  super
19
19
  @thread = Thread.new { initialize_thread }
20
20
  rescue
21
- raise Errors::Process::Event::Initializer
21
+ raise Errors::Process::EventAdmin::Initializer
22
22
  end
23
23
 
24
24
  # Create a thread for execute a block code in a thread
@@ -36,7 +36,7 @@ module RubyRabbitmqJanus
36
36
  end
37
37
  end
38
38
  rescue
39
- raise Errors::Process::Event::Run
39
+ raise Errors::Process::EventAdmin::Run
40
40
  end
41
41
 
42
42
  private
@@ -24,10 +24,12 @@ module RubyRabbitmqJanus
24
24
  response = nil
25
25
  lock.synchronize do
26
26
  response = responses.shift
27
+ raise Errors::Rabbit::Listener::ResponseEmpty, response \
28
+ if response.size.zero?
27
29
  end
28
30
  yield response.event, response
29
31
  rescue
30
- raise Errors::Rabbit::Listener::Base::ListenEvents
32
+ raise Errors::Rabbit::Listener::Base::ListenEvents, reply
31
33
  end
32
34
 
33
35
  private
@@ -23,12 +23,20 @@ module RubyRabbitmqJanus
23
23
  # @return [Hash] Format hash for bunny settings
24
24
  def server_settings
25
25
  Hash[%w[host port pass user vhost log_level].map do |value|
26
- [
27
- value.to_sym,
28
- @options['rabbit'][value.eql?('log_level') ? 'level' : value]
29
- ]
26
+ key = value.to_sym
27
+ j_value = @options['rabbit'][rabbitmq_conf(value)]
28
+
29
+ raise Errors::Tools::Config::Rabbitmq value if j_value.blank?
30
+
31
+ [key, j_value]
30
32
  end]
31
33
  end
34
+
35
+ private
36
+
37
+ def rabbitmq_conf(value)
38
+ value.eql?('log_level') ? 'level' : value
39
+ end
32
40
  end
33
41
  end
34
42
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_rabbitmq_janus
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.pre.334
4
+ version: 3.0.0.pre.335
5
5
  platform: ruby
6
6
  authors:
7
7
  - VAILLANT Jeremy
@@ -453,10 +453,7 @@ files:
453
453
  - lib/rrj/errors/janus/transactions/transaction.rb
454
454
  - lib/rrj/errors/process/concurency.rb
455
455
  - lib/rrj/errors/process/event.rb
456
- - lib/rrj/errors/process/keepalive.rb
457
- - lib/rrj/errors/process/keepalive/initializer.rb
458
- - lib/rrj/errors/process/keepalive/thread.rb
459
- - lib/rrj/errors/process/keepalive/timer.rb
456
+ - lib/rrj/errors/process/event_admin.rb
460
457
  - lib/rrj/errors/rabbit/base_event.rb
461
458
  - lib/rrj/errors/rabbit/connect.rb
462
459
  - lib/rrj/errors/rabbit/listener/base.rb
@@ -1,21 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
4
- # @see RubyRabbitmqJanus::Janus::Keepalive Keepalive thread
5
-
6
- module RubyRabbitmqJanus
7
- module Errors
8
- module Process
9
- # Define a super class for all error in Process::Concurency::Keepalive
10
- class BaseKeepalive < RubyRabbitmqJanus::Errors::Process::BaseConcurency
11
- def initialize(message)
12
- super "[Keepalive]#{message}"
13
- end
14
- end
15
- end
16
- end
17
- end
18
-
19
- require 'rrj/errors/process/keepalive/initializer'
20
- require 'rrj/errors/process/keepalive/thread'
21
- require 'rrj/errors/process/keepalive/timer'
@@ -1,59 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :reek:IrresponsibleModule
4
-
5
- module RubyRabbitmqJanus
6
- module Errors
7
- module Process
8
- class BaseKeepaliveInitializer < BaseKeepalive
9
- def initialize(message)
10
- super "[Initializer] #{message}"
11
- end
12
- end
13
-
14
- module KeepaliveInitializer
15
- class Initializer < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
16
- def initialize
17
- super 'Error keepalive initializer'
18
- end
19
- end
20
-
21
- class ID2ref < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
22
- def initialize(thread_id)
23
- super "No thread with ID : #{thread_id}"
24
- end
25
- end
26
-
27
- class Session < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
28
- def initialize
29
- super 'Error return session number'
30
- end
31
- end
32
-
33
- class Thread < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
34
- def initialize
35
- super 'Error for get Object Thread ID'
36
- end
37
- end
38
-
39
- class ThreadStart < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
40
- def initialize
41
- super 'Error for starting timer in thread'
42
- end
43
- end
44
-
45
- class ThreadStop < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
46
- def initialize
47
- super 'Error for stoping timer in thread'
48
- end
49
- end
50
-
51
- class ThreadDelete < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveInitializer
52
- def initialize
53
- super 'Error for destroy thread'
54
- end
55
- end
56
- end
57
- end
58
- end
59
- end
@@ -1,54 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :reek:IrresponsibleModule
4
-
5
- module RubyRabbitmqJanus
6
- module Errors
7
- module Process
8
- # Define a super class for all error in Process::Concurency::Keepalive
9
- class BaseKeepaliveThread < BaseKeepalive
10
- def initialize(message)
11
- super "[Thread] #{message}"
12
- end
13
- end
14
-
15
- module KeepaliveThread
16
- class Initializer < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
17
- def initialize
18
- super 'Error for initialize Keepalive Thread'
19
- end
20
- end
21
-
22
- class InitializeJanusSession < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
23
- def initialize
24
- super 'Error when initialize message in keepalive thread'
25
- end
26
- end
27
-
28
- class RestartSession < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
29
- def initialize
30
- super 'Error when restart session'
31
- end
32
- end
33
-
34
- class Start < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
35
- def initialize
36
- super 'Error when start a loop for sending keepalive message'
37
- end
38
- end
39
-
40
- class Kill < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
41
- def initialize
42
- super 'Error when killing thread'
43
- end
44
- end
45
-
46
- class InstanceIsDown < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveThread
47
- def initialize
48
- super 'Error when instance is down'
49
- end
50
- end
51
- end
52
- end
53
- end
54
- end
@@ -1,47 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- # :reek:IrresponsibleModule
4
-
5
- module RubyRabbitmqJanus
6
- module Errors
7
- module Process
8
- class BaseKeepaliveTimer < BaseKeepalive
9
- def initialize(message)
10
- super "[Timer] #{message}"
11
- end
12
- end
13
-
14
- module KeepaliveTimer
15
- class Initializer < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveTimer
16
- def initialize
17
- super 'Error for initialize Keepalive Timer'
18
- end
19
- end
20
-
21
- class LoopKeepalive < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveTimer
22
- def initialize
23
- super 'Loop for create timer in Keepalive Thread is failed'
24
- end
25
- end
26
-
27
- class Session < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveTimer
28
- def initialize
29
- super 'Timeout for get session number in keepalive request'
30
- end
31
- end
32
-
33
- class StopTimer < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveTimer
34
- def initialize
35
- super 'Error when timer to Keepalive Thread stop'
36
- end
37
- end
38
-
39
- class StartTimer < RubyRabbitmqJanus::Errors::Process::BaseKeepaliveTimer
40
- def initialize
41
- super 'Error when timer to Keepalive Thread start'
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end