ruby_rabbitmq_janus 2.0.0 → 2.1.0.pre.128
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -3
- data/Rakefile +98 -0
- data/config/default.md +6 -3
- data/config/default.yml +7 -1
- data/lib/generators/ruby_rabbitmq_janus/install_generator.rb +3 -0
- data/lib/generators/ruby_rabbitmq_janus/migration_generator.rb +30 -0
- data/lib/generators/ruby_rabbitmq_janus/templates/migration.rb +14 -0
- data/lib/rrj/admin.rb +2 -0
- data/lib/rrj/errors/base/admin.rb +24 -0
- data/lib/rrj/errors/base/base.rb +5 -0
- data/lib/rrj/errors/base/init.rb +46 -0
- data/lib/rrj/errors/base/task.rb +32 -0
- data/lib/rrj/errors/error.rb +4 -3
- data/lib/rrj/errors/janus/janus.rb +20 -7
- data/lib/rrj/errors/janus/messages/admin.rb +33 -0
- data/lib/rrj/errors/janus/messages/message.rb +51 -0
- data/lib/rrj/errors/janus/messages/standard.rb +33 -0
- data/lib/rrj/errors/janus/processus/concurency.rb +23 -0
- data/lib/rrj/errors/janus/processus/event.rb +30 -0
- data/lib/rrj/errors/janus/processus/keepalive.rb +33 -0
- data/lib/rrj/errors/janus/responses/admin.rb +39 -0
- data/lib/rrj/errors/janus/responses/event.rb +46 -0
- data/lib/rrj/errors/janus/responses/response.rb +44 -0
- data/lib/rrj/errors/janus/responses/standard.rb +58 -0
- data/lib/rrj/errors/janus/transactions/admin.rb +37 -0
- data/lib/rrj/errors/janus/transactions/handle.rb +52 -0
- data/lib/rrj/errors/janus/transactions/session.rb +38 -0
- data/lib/rrj/errors/janus/transactions/transaction.rb +23 -0
- data/lib/rrj/errors/rabbit/connect.rb +58 -0
- data/lib/rrj/errors/rabbit/propertie.rb +37 -0
- data/lib/rrj/errors/rabbit/publish/admin.rb +30 -0
- data/lib/rrj/errors/rabbit/publish/base_publisher.rb +23 -0
- data/lib/rrj/errors/rabbit/publish/exclusive.rb +31 -0
- data/lib/rrj/errors/rabbit/publish/listener.rb +30 -0
- data/lib/rrj/errors/rabbit/publish/non_exclusive.rb +31 -0
- data/lib/rrj/errors/rabbit/publish/publisher.rb +30 -0
- data/lib/rrj/errors/rabbit/rabbit.rb +14 -23
- data/lib/rrj/errors/tools/gem/cluster.rb +44 -0
- data/lib/rrj/errors/tools/gem/config.rb +89 -0
- data/lib/rrj/errors/tools/gem/log.rb +86 -0
- data/lib/rrj/errors/tools/gem/option.rb +37 -0
- data/lib/rrj/errors/tools/gem/request.rb +23 -0
- data/lib/rrj/errors/tools/replaces/replace.rb +30 -0
- data/lib/rrj/errors/tools/replaces/type.rb +30 -0
- data/lib/rrj/errors/tools/tools.rb +21 -1
- data/lib/rrj/info.rb +1 -1
- data/lib/rrj/init.rb +22 -4
- data/lib/rrj/janus/messages/admin.rb +9 -4
- data/lib/rrj/janus/messages/message.rb +20 -9
- data/lib/rrj/janus/messages/standard.rb +8 -2
- data/lib/rrj/janus/processus/concurrency.rb +2 -0
- data/lib/rrj/janus/processus/event.rb +8 -0
- data/lib/rrj/janus/processus/keepalive.rb +15 -23
- data/lib/rrj/janus/responses/admin.rb +6 -0
- data/lib/rrj/janus/responses/event.rb +8 -0
- data/lib/rrj/janus/responses/response.rb +8 -11
- data/lib/rrj/janus/responses/standard.rb +12 -0
- data/lib/rrj/janus/transactions/admin.rb +6 -0
- data/lib/rrj/janus/transactions/handle.rb +25 -3
- data/lib/rrj/janus/transactions/session.rb +6 -0
- data/lib/rrj/janus/transactions/transaction.rb +3 -9
- data/lib/rrj/models/active_record.rb +14 -0
- data/lib/rrj/models/concerns/janus_instance_concern.rb +47 -0
- data/lib/rrj/models/mongoid.rb +19 -0
- data/lib/rrj/rabbit/connect.rb +12 -8
- data/lib/rrj/rabbit/propertie.rb +23 -6
- data/lib/rrj/rabbit/publish/admin.rb +4 -0
- data/lib/rrj/rabbit/publish/base_publisher.rb +2 -1
- data/lib/rrj/rabbit/publish/exclusive.rb +4 -0
- data/lib/rrj/rabbit/publish/listener.rb +6 -0
- data/lib/rrj/rabbit/publish/non_exclusive.rb +4 -0
- data/lib/rrj/rabbit/publish/publisher.rb +4 -4
- data/lib/rrj/railtie.rb +15 -0
- data/lib/rrj/task.rb +51 -0
- data/lib/rrj/tools/gem/cluster.rb +65 -0
- data/lib/rrj/tools/gem/config.rb +38 -6
- data/lib/rrj/tools/gem/log.rb +24 -4
- data/lib/rrj/tools/gem/option.rb +21 -17
- data/lib/rrj/tools/gem/requests.rb +11 -7
- data/lib/rrj/tools/replaces/replace.rb +4 -0
- data/lib/rrj/tools/replaces/type.rb +4 -0
- data/lib/rrj/tools/tools.rb +1 -0
- data/lib/ruby_rabbitmq_janus.rb +3 -0
- data/lib/tasks/delete_all_instance.rake +12 -0
- data/spec/request/admin/request_handle_info_spec.rb +4 -3
- data/spec/request/admin/request_handles_spec.rb +4 -3
- data/spec/request/peer/request_trickle_spec.rb +1 -1
- data/spec/rrj/rabbit/propertie_spec.rb +37 -2
- data/spec/rrj/tools/gem/rrj_cluster_spec.rb +26 -0
- data/spec/rrj/tools/gem/rrj_config_spec.rb +78 -0
- data/spec/rrj/tools/gem/rrj_log_spec.rb +55 -0
- data/spec/rrj/tools/{replace_admin_spec.rb → replace/replace_admin_spec.rb} +0 -0
- data/spec/rrj/tools/{replace_handle_spec.rb → replace/replace_handle_spec.rb} +0 -0
- data/spec/rrj/tools/{replace_session_spec.rb → replace/replace_session_spec.rb} +0 -0
- data/spec/rrj/tools/{replace_spec.rb → replace/replace_spec.rb} +0 -0
- data/spec/rrj/tools/{type_spec.rb → replace/type_spec.rb} +0 -0
- data/spec/spec_helper.rb +33 -2
- data/spec/support/examples_config.rb +10 -0
- data/spec/support/examples_message.rb +0 -2
- data/spec/support/examples_request.rb +4 -4
- data/spec/support/schemas/config/config.json +4 -2
- data/spec/support/schemas/config/rabbit_options.json +1 -1
- data/spec/support/schemas/config/rabbit_options2.json +13 -0
- data/spec/support/schemas/config/rabbit_options_admin.json +1 -1
- data/spec/support/schemas/config/rabbit_options_admin2.json +13 -0
- metadata +98 -17
- data/lib/rrj/errors/init.rb +0 -69
- data/lib/rrj/errors/janus/janus_message.rb +0 -53
- data/lib/rrj/errors/janus/janus_processus_keepalive.rb +0 -48
- data/lib/rrj/errors/janus/janus_response.rb +0 -89
- data/lib/rrj/errors/janus/janus_transaction.rb +0 -29
- data/lib/rrj/errors/tools/config.rb +0 -43
- data/spec/rrj/rrj_config_spec.rb +0 -67
- data/spec/rrj/rrj_log_spec.rb +0 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 145a92290f85819905c987caccbf3127e28d12df
|
4
|
+
data.tar.gz: dbf3295bceb7e8df8983d5f707bdbd64903bc727
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76bc2310f46da751c961873e18e21375a0be669827fbe3a2cf7694f16e11c88e22715669c5dacb6a37596036b43c6bfe33ad344996bc9ca52dd7dd4f5bb29078
|
7
|
+
data.tar.gz: 2fbeed0d2e4308f5dd242b55eafbad87e8f30dbf56a77738de1f78df5d7292f47e6f5cf98ae2f312b3e903cfd60aa4ca73e8c45f1097164bcd7a94a1cb9142ca
|
data/README.md
CHANGED
@@ -29,8 +29,10 @@ This gem is product by [Dazzl.tv](http://dazzl.tv)
|
|
29
29
|
| | <---------------------------- |
|
30
30
|
| <-------------------------------- | |
|
31
31
|
| | |
|
32
|
-
| | |
|
33
|
-
| | |
|
32
|
+
| | | # If asynchron message
|
33
|
+
| | | # send a response after execution
|
34
|
+
| | <---------------------------- | # but a acknoledge message is
|
35
|
+
| <-------------------------------- | | # sending when request is received
|
34
36
|
| | |
|
35
37
|
```
|
36
38
|
|
@@ -39,6 +41,7 @@ This gem is product by [Dazzl.tv](http://dazzl.tv)
|
|
39
41
|
* [How to use](#how-to-use)
|
40
42
|
* [Installation](#installation)
|
41
43
|
* [Configuration](#configuration)
|
44
|
+
* [Janus](#janus)
|
42
45
|
* [Generators](#generators)
|
43
46
|
* [Requests](#requests)
|
44
47
|
* [Usage](#usage)
|
@@ -74,13 +77,21 @@ bundle
|
|
74
77
|
Or install it yourself as :
|
75
78
|
|
76
79
|
```linux
|
77
|
-
gem install
|
80
|
+
gem install ruby_rabbitmq_janus
|
78
81
|
```
|
79
82
|
|
80
83
|
### Configuration
|
81
84
|
|
82
85
|
If you want used a customize configuration see [ruby-rabbitmq-janus.yml](config/default.md)
|
83
86
|
|
87
|
+
#### Janus
|
88
|
+
|
89
|
+
Configure one (or many) Janus server.
|
90
|
+
[See janus gateway documentation.](https://janus.conf.meetecho.com/docs/)
|
91
|
+
|
92
|
+
Configure the queue with rabbit with incremental number. So the first instance
|
93
|
+
take a name `to-janus-1` and all queues `from` sending in same queue.
|
94
|
+
|
84
95
|
#### Generators
|
85
96
|
|
86
97
|
Use generator for complete installation :
|
data/Rakefile
CHANGED
@@ -9,4 +9,102 @@ RSpec::Core::RakeTask.new(:no_request_spec) do |t|
|
|
9
9
|
t.rspec_opts = '--tag ~type:request'
|
10
10
|
end
|
11
11
|
|
12
|
+
RSpec::Core::RakeTask.new(:info) do |t|
|
13
|
+
t.rspec_opts = '--tag name:info'
|
14
|
+
end
|
15
|
+
|
16
|
+
RSpec::Core::RakeTask.new(:handle_info) do |t|
|
17
|
+
t.rspec_opts = '--tag name:handle_info'
|
18
|
+
end
|
19
|
+
|
20
|
+
RSpec::Core::RakeTask.new(:handles) do |t|
|
21
|
+
t.rspec_opts = '--tag name:handles'
|
22
|
+
end
|
23
|
+
|
24
|
+
RSpec::Core::RakeTask.new(:sessions) do |t|
|
25
|
+
t.rspec_opts = '--tag name:sessions'
|
26
|
+
end
|
27
|
+
|
28
|
+
RSpec::Core::RakeTask.new(:set_locking_debug) do |t|
|
29
|
+
t.rspec_opts = '--tag name:set_locking_debug'
|
30
|
+
end
|
31
|
+
|
32
|
+
RSpec::Core::RakeTask.new(:set_log_level) do |t|
|
33
|
+
t.rspec_opts = '--tag name:set_log_level'
|
34
|
+
end
|
35
|
+
|
36
|
+
RSpec::Core::RakeTask.new(:tokens) do |t|
|
37
|
+
t.rspec_opts = '--tag name:tokens'
|
38
|
+
end
|
39
|
+
|
40
|
+
RSpec::Core::RakeTask.new(:attach) do |t|
|
41
|
+
t.rspec_opts = '--tag name:attach'
|
42
|
+
end
|
43
|
+
|
44
|
+
RSpec::Core::RakeTask.new(:create) do |t|
|
45
|
+
t.rspec_opts = '--tag name:create'
|
46
|
+
end
|
47
|
+
|
48
|
+
RSpec::Core::RakeTask.new(:destroy) do |t|
|
49
|
+
t.rspec_opts = '--tag name:destroy'
|
50
|
+
end
|
51
|
+
|
52
|
+
RSpec::Core::RakeTask.new(:detach) do |t|
|
53
|
+
t.rspec_opts = '--tag name:detach'
|
54
|
+
end
|
55
|
+
|
56
|
+
RSpec::Core::RakeTask.new(:keepalive) do |t|
|
57
|
+
t.rspec_opts = '--tag name:keepalive'
|
58
|
+
end
|
59
|
+
|
60
|
+
RSpec::Core::RakeTask.new(:offer) do |t|
|
61
|
+
t.rspec_opts = '--tag name:offer'
|
62
|
+
end
|
63
|
+
|
64
|
+
RSpec::Core::RakeTask.new(:trickle) do |t|
|
65
|
+
t.rspec_opts = '--tag name:trickle'
|
66
|
+
end
|
67
|
+
|
68
|
+
RSpec::Core::RakeTask.new(:trickles) do |t|
|
69
|
+
t.rspec_opts = '--tag name:trickles'
|
70
|
+
end
|
71
|
+
|
72
|
+
RSpec::Core::RakeTask.new(:type_tools) do |t|
|
73
|
+
t.rspec_opts = '--tag type:tools'
|
74
|
+
end
|
75
|
+
|
76
|
+
RSpec::Core::RakeTask.new(:type_cluster) do |t|
|
77
|
+
t.rspec_opts = '--tag type:cluster'
|
78
|
+
end
|
79
|
+
|
80
|
+
RSpec::Core::RakeTask.new(:type_config) do |t|
|
81
|
+
t.rspec_opts = '--tag type:config'
|
82
|
+
end
|
83
|
+
|
84
|
+
RSpec::Core::RakeTask.new(:type_responses) do |t|
|
85
|
+
t.rspec_opts = '--tag type:responses'
|
86
|
+
end
|
87
|
+
|
88
|
+
RSpec::Core::RakeTask.new(:type_rabbit) do |t|
|
89
|
+
t.rspec_opts = '--tag type:rabbit'
|
90
|
+
end
|
91
|
+
|
92
|
+
RSpec::Core::RakeTask.new(:type_message) do |t|
|
93
|
+
t.rspec_opts = '--tag type:message'
|
94
|
+
end
|
95
|
+
|
96
|
+
RSpec::Core::RakeTask.new(:except_request) do |t|
|
97
|
+
t.rspec_opts = '--tag ~type:request'
|
98
|
+
end
|
99
|
+
|
100
|
+
RSpec::Core::RakeTask.new(:instances) do |t|
|
101
|
+
t.rspec_opts = '--tag instances:true'
|
102
|
+
end
|
103
|
+
|
12
104
|
task default: :spec
|
105
|
+
|
106
|
+
task all: [:info, :handle_info, :sessions, :set_locking_debug,
|
107
|
+
:set_log_level, :tokens, :attach, :create, :destroy,
|
108
|
+
:detach, :keepalive, :offer, :trickle, :trickles,
|
109
|
+
:except_request]
|
110
|
+
task two_instances: :instances
|
data/config/default.md
CHANGED
@@ -17,11 +17,14 @@ queues:
|
|
17
17
|
standard:
|
18
18
|
from: from-janus
|
19
19
|
to: to-janus
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
admin:
|
21
|
+
from: from-janus-admin
|
22
|
+
to: to-janus-admin
|
23
23
|
|
24
24
|
janus:
|
25
|
+
cluster:
|
26
|
+
enabled: false
|
27
|
+
count: 0
|
25
28
|
session:
|
26
29
|
keepalive: 45
|
27
30
|
plugins:
|
data/config/default.yml
CHANGED
@@ -28,6 +28,12 @@ queues:
|
|
28
28
|
|
29
29
|
# Janus plugin used
|
30
30
|
janus:
|
31
|
+
# Options for clusturing Janus Instance
|
32
|
+
cluster:
|
33
|
+
# Enable/Disable cluster mode
|
34
|
+
enabled: false
|
35
|
+
# Number to cluster
|
36
|
+
count: 1
|
31
37
|
# Option for sessions
|
32
38
|
session:
|
33
39
|
# Define time to send a keepalive message in seconds
|
@@ -44,4 +50,4 @@ gem:
|
|
44
50
|
log:
|
45
51
|
# Define level to log
|
46
52
|
# UNKNOW, FATAL, ERROR, WARN, INFO, DEBUG
|
47
|
-
level:
|
53
|
+
level: debug
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string-literal: true
|
2
|
+
|
3
|
+
# :reek:IrresponsibleModule
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
# Module for generators
|
7
|
+
module Generators
|
8
|
+
if defined?(ActiveRecord) && !defined?(Mongo)
|
9
|
+
# Create a migration for rails project with active record
|
10
|
+
class MigrationGenerator < ::Rails::Generators::Base
|
11
|
+
require 'rails/generators/active_record'
|
12
|
+
|
13
|
+
include Rails::Generators::Migration
|
14
|
+
|
15
|
+
desc 'Add to rails project RubyRabbitmqJanus migration file.'
|
16
|
+
|
17
|
+
source_root File.expand_path('../templates', __FILE__)
|
18
|
+
|
19
|
+
def install
|
20
|
+
migration_template 'migration.rb',
|
21
|
+
'db/migrate/create_ruby_rabbitmq_janus_tables.rb'
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.next_migration_number(dirname)
|
25
|
+
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# :reek:FeatureEnvy
|
4
|
+
|
5
|
+
# Fields for JanusInstance model
|
6
|
+
class CreateRubyRabbitmqJanusTables < ActiveRecord::Migration[5.0]
|
7
|
+
def change
|
8
|
+
create_table :janus_instances do |table|
|
9
|
+
table.integer :instance
|
10
|
+
table.integer :session, limit: 8
|
11
|
+
table.boolean :enable
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/lib/rrj/admin.rb
CHANGED
@@ -29,6 +29,8 @@ module RubyRabbitmqJanus
|
|
29
29
|
session = option.use_current_session?(options)
|
30
30
|
transaction = Janus::Transactions::Admin.new(session)
|
31
31
|
transaction.connect { yield(transaction) }
|
32
|
+
rescue
|
33
|
+
raise Errors::RRJAdmin::StartTransactionAdmin, options
|
32
34
|
end
|
33
35
|
end
|
34
36
|
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
# Define all error in gem
|
7
|
+
module Errors
|
8
|
+
# Define a super class for all errors in RRJ Class
|
9
|
+
class BaseRRJAdmin < RRJError
|
10
|
+
def initalize(message, level)
|
11
|
+
super "[RRJAdmin] #{message}", level
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module RRJAdmin
|
16
|
+
# Error for RRJAdmin#start_transaction_admin
|
17
|
+
class StartTransactionAdmin < RubyRabbitmqJanus::Errors::BaseRRJAdmin
|
18
|
+
def initialize(opts)
|
19
|
+
super "Transaction admin failed with -- #{opts}", :fatal
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
# Define all error in gem
|
7
|
+
module Errors
|
8
|
+
# Define a super class for all errors in RRJ Class
|
9
|
+
class BaseRRJ < RRJError
|
10
|
+
def initalize(message, level)
|
11
|
+
super "[RRJ] #{message}", level
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module RRJ
|
16
|
+
# Error for RRJ#initialize
|
17
|
+
class InstanciateGem < RubyRabbitmqJanus::Errors::BaseRRJ
|
18
|
+
def initialize(message)
|
19
|
+
super "Gem is not instanciate correctly : #{message}", :fatal
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Error for RRJ#start_transaction
|
24
|
+
class StartTransaction < RubyRabbitmqJanus::Errors::BaseRRJ
|
25
|
+
def initialize(exclu, opts)
|
26
|
+
super "Transaction failed with -- #{opts} in queue #{exclu}", :fatal
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
# Error for RRJ#start_transaction_handle
|
31
|
+
class StartTransactionHandle < RubyRabbitmqJanus::Errors::BaseRRJ
|
32
|
+
def initialize(exclu, opts)
|
33
|
+
super "Transaction handle failed with -- #{opts} in queue #{exclu}",
|
34
|
+
:fatal
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
# Error for RRJ#cleanup_connection
|
39
|
+
class CleanupConnection < RubyRabbitmqJanus::Errors::BaseRRJ
|
40
|
+
def initialize
|
41
|
+
super 'Error for cleanup Janus Instances', :warn
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
# Define all error in gem
|
7
|
+
module Errors
|
8
|
+
# Define a super class for all errors in RRJ Class
|
9
|
+
class BaseRRJTask < RRJError
|
10
|
+
def initalize(message, level = :fatal)
|
11
|
+
super "[RRJAdmin] #{message}", level
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
module RRJTask
|
16
|
+
# Error for RRJTask#initialize
|
17
|
+
class Initialize < BaseRRJTask
|
18
|
+
def initialize
|
19
|
+
super 'Error in initializer'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# Error for RRJTask#start_transaction_handle
|
24
|
+
class StartTransactionHandle < BaseRRJTask
|
25
|
+
def initialize(exclu, opts)
|
26
|
+
super "Transaction admin failed with -- #{opts} in queue #{exclu}",
|
27
|
+
:fatal
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
data/lib/rrj/errors/error.rb
CHANGED
@@ -13,14 +13,15 @@ module RubyRabbitmqJanus
|
|
13
13
|
# @param [Symbol] level Important to error
|
14
14
|
def initialize(message, level)
|
15
15
|
super(message)
|
16
|
-
log = Tools::Log.instance
|
17
|
-
Tools::Log.instance_method(level)
|
16
|
+
log = RubyRabbitmqJanus::Tools::Log.instance
|
17
|
+
RubyRabbitmqJanus::Tools::Log.instance_method(level)\
|
18
|
+
.bind(log).call(message)
|
18
19
|
end
|
19
20
|
end
|
20
21
|
end
|
21
22
|
end
|
22
23
|
|
23
|
-
require 'rrj/errors/
|
24
|
+
require 'rrj/errors/base/base'
|
24
25
|
require 'rrj/errors/janus/janus'
|
25
26
|
require 'rrj/errors/tools/tools'
|
26
27
|
require 'rrj/errors/rabbit/rabbit'
|
@@ -5,18 +5,31 @@
|
|
5
5
|
module RubyRabbitmqJanus
|
6
6
|
module Errors
|
7
7
|
# Define errors to message sending and response to janus
|
8
|
-
class
|
8
|
+
class BaseJanus < RRJError
|
9
9
|
# Initialize a error standard for janus module
|
10
10
|
#
|
11
11
|
# @param [String] message Text returning in raise
|
12
|
-
def initialize(message)
|
13
|
-
super "[JANUS]#{message}",
|
12
|
+
def initialize(message, level)
|
13
|
+
super "[JANUS]#{message}", level
|
14
14
|
end
|
15
15
|
end
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
require 'rrj/errors/janus/
|
20
|
-
require 'rrj/errors/janus/
|
21
|
-
require 'rrj/errors/janus/
|
22
|
-
|
19
|
+
require 'rrj/errors/janus/processus/concurency'
|
20
|
+
require 'rrj/errors/janus/processus/keepalive'
|
21
|
+
require 'rrj/errors/janus/processus/event'
|
22
|
+
|
23
|
+
require 'rrj/errors/janus/messages/message'
|
24
|
+
require 'rrj/errors/janus/messages/admin'
|
25
|
+
require 'rrj/errors/janus/messages/standard'
|
26
|
+
|
27
|
+
require 'rrj/errors/janus/responses/response'
|
28
|
+
require 'rrj/errors/janus/responses/admin'
|
29
|
+
require 'rrj/errors/janus/responses/event'
|
30
|
+
require 'rrj/errors/janus/responses/standard'
|
31
|
+
|
32
|
+
require 'rrj/errors/janus/transactions/transaction'
|
33
|
+
require 'rrj/errors/janus/transactions/admin'
|
34
|
+
require 'rrj/errors/janus/transactions/handle'
|
35
|
+
require 'rrj/errors/janus/transactions/session'
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
4
|
+
|
5
|
+
module RubyRabbitmqJanus
|
6
|
+
module Errors
|
7
|
+
# Define errors to message sending and response to janus
|
8
|
+
module Janus
|
9
|
+
# Define a super class for all error in Janus::MessageAdmin
|
10
|
+
class BaseMessageAdmin < BaseMessage
|
11
|
+
def initialize(message, level = :fatal)
|
12
|
+
super "[Admin] #{message}", level
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
module MessageAdmin
|
17
|
+
# Error Janus::MessageAdmin#initialize
|
18
|
+
class Initializer < BaseMessageAdmin
|
19
|
+
def initialize
|
20
|
+
super 'Error in initializer'
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Error Janus::MessageAdmin#options
|
25
|
+
class Options < BaseMessageAdmin
|
26
|
+
def initialize
|
27
|
+
super 'Return properties message admin failed'
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|