ruby_rabbitmq_janus 0.3.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +64 -7
- data/.reek +7 -0
- data/.rubocop.yml +0 -3
- data/README.md +40 -2
- data/config/default.md +22 -6
- data/config/default.yml +24 -6
- data/config/requests/{test.json → admin/handle_info.json} +2 -4
- data/config/requests/admin/handles.json +6 -0
- data/config/requests/admin/log_level.json +6 -0
- data/config/requests/admin/sessions.json +5 -0
- data/config/requests/{attach.json → base/attach.json} +0 -0
- data/config/requests/{create.json → base/create.json} +0 -0
- data/config/requests/{destroy.json → base/destroy.json} +0 -0
- data/config/requests/{detach.json → base/detach.json} +0 -0
- data/config/requests/{info.json → base/info.json} +0 -0
- data/config/requests/base/keepalive.json +5 -0
- data/lib/generators/ruby_rabbitmq_janus/configuration_generator.rb +23 -0
- data/lib/generators/ruby_rabbitmq_janus/create_request_generator.rb +90 -0
- data/lib/generators/ruby_rabbitmq_janus/default_request_generator.rb +21 -0
- data/lib/generators/ruby_rabbitmq_janus/initializer_generator.rb +17 -0
- data/lib/rrj/errors/config.rb +21 -0
- data/lib/rrj/errors/error.rb +56 -0
- data/lib/rrj/errors/janus.rb +14 -0
- data/lib/rrj/errors/janus_message.rb +45 -0
- data/lib/rrj/errors/janus_response.rb +78 -0
- data/lib/rrj/errors/janus_transaction.rb +31 -0
- data/lib/rrj/errors/rabbit.rb +21 -0
- data/lib/rrj/errors/request.rb +21 -0
- data/lib/rrj/info.rb +40 -0
- data/lib/rrj/init.rb +113 -44
- data/lib/rrj/janus/admin.rb +27 -0
- data/lib/rrj/janus/janus.rb +10 -33
- data/lib/rrj/janus/keepalive.rb +69 -0
- data/lib/rrj/janus/message.rb +77 -22
- data/lib/rrj/janus/response.rb +79 -41
- data/lib/rrj/janus/transaction.rb +53 -0
- data/lib/rrj/janus/transaction_admin.rb +43 -0
- data/lib/rrj/janus/transaction_handle.rb +40 -0
- data/lib/rrj/janus/transaction_session.rb +17 -0
- data/lib/rrj/rabbit/connect.rb +75 -0
- data/lib/rrj/rabbit/propertie.rb +37 -0
- data/lib/rrj/rabbit/publish.rb +100 -0
- data/lib/rrj/rabbit/rabbit.rb +11 -0
- data/lib/rrj/tools/config.rb +63 -0
- data/lib/rrj/tools/env.rb +21 -0
- data/lib/rrj/tools/log.rb +106 -0
- data/lib/rrj/tools/replaces.rb +115 -0
- data/lib/rrj/tools/replaces_admin.rb +44 -0
- data/lib/rrj/tools/requests.rb +57 -0
- data/lib/rrj/tools/tools.rb +14 -0
- data/lib/ruby_rabbitmq_janus.rb +8 -13
- data/rrj.gemspec +7 -3
- metadata +108 -28
- data/config.reek +0 -3
- data/lib/rrj/config.rb +0 -57
- data/lib/rrj/janus/error.rb +0 -8
- data/lib/rrj/janus/message_async.rb +0 -54
- data/lib/rrj/janus/message_sync.rb +0 -34
- data/lib/rrj/log.rb +0 -63
- data/lib/rrj/rabbitmq/rabbitmq.rb +0 -82
- data/lib/rrj/request/path.rb +0 -21
- data/lib/rrj/request/replaces.rb +0 -109
- data/lib/rrj/request/requests.rb +0 -55
- data/lib/rrj/request/type_data.rb +0 -30
- data/lib/rrj/version.rb +0 -17
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a6cd4ddd4d531fad7d95ba9f66a16534d66cd35e
|
4
|
+
data.tar.gz: 5432f6b8bfa2ef968a03cf6cfd57e841f8965735
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd17673a91b51bddc0cca8c0ab788e1bb6d4e5baf601942bcd3df79d23c6f703ed742921d92c5feeb34b47494dfbf0e17cb5cf45f4bfef43605d55f04c7928a6
|
7
|
+
data.tar.gz: 97e18cb653f2c45a86f06b99f4ec995265c525e23138c5cf79efdc73eb8a2070c1df5f37727a2b6bdf38632203b40e2338eb48d9bfaa62a6fd187fc4c94831e1
|
data/.gitignore
CHANGED
@@ -1,14 +1,71 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
# Created by https://www.gitignore.io/api/ruby
|
2
|
+
|
3
|
+
### Ruby ###
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
5
7
|
/coverage/
|
6
|
-
/
|
8
|
+
/InstalledFiles
|
7
9
|
/pkg/
|
8
10
|
/spec/reports/
|
11
|
+
/spec/examples.txt
|
12
|
+
/test/tmp/
|
13
|
+
/test/version_tmp/
|
9
14
|
/tmp/
|
15
|
+
/log/
|
10
16
|
|
11
|
-
|
17
|
+
# Used by dotenv library to load environment variables.
|
18
|
+
# .env
|
19
|
+
|
20
|
+
## Specific to RubyMotion:
|
21
|
+
.dat*
|
22
|
+
.repl_history
|
23
|
+
build/
|
24
|
+
*.bridgesupport
|
25
|
+
build-iPhoneOS/
|
26
|
+
build-iPhoneSimulator/
|
27
|
+
|
28
|
+
## Specific to RubyMotion (use of CocoaPods):
|
29
|
+
#
|
30
|
+
# We recommend against adding the Pods directory to your .gitignore. However
|
31
|
+
# you should judge for yourself, the pros and cons are mentioned at:
|
32
|
+
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
|
33
|
+
#
|
34
|
+
# vendor/Pods/
|
12
35
|
|
13
|
-
|
36
|
+
## Documentation cache and generated files:
|
37
|
+
/.yardoc/
|
38
|
+
/_yardoc/
|
39
|
+
/doc/
|
40
|
+
/rdoc/
|
41
|
+
|
42
|
+
## Environment normalization:
|
43
|
+
/.bundle/
|
44
|
+
/vendor/bundle
|
45
|
+
/lib/bundler/man/
|
46
|
+
|
47
|
+
# for a library or gem, you might want to ignore these files since the code is
|
48
|
+
# intended to run in multiple environments; otherwise, check them in:
|
49
|
+
Gemfile.lock
|
50
|
+
# .ruby-version
|
51
|
+
# .ruby-gemset
|
52
|
+
|
53
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
54
|
+
.rvmrc
|
55
|
+
|
56
|
+
### ruby-rabbitmq-janus ###
|
57
|
+
|
58
|
+
## Configuration customize
|
14
59
|
config/ruby-rabbitmq-janus.yml
|
60
|
+
|
61
|
+
## Request customize
|
62
|
+
config/requests/channel
|
63
|
+
config/requests/videocast
|
64
|
+
|
65
|
+
## Schema JSON response
|
66
|
+
spec/support/schemas/request/channel
|
67
|
+
spec/support/schemas/request/videocast
|
68
|
+
|
69
|
+
## Unitaire test for request customize
|
70
|
+
spec/request/channel
|
71
|
+
spec/request/videocast
|
data/.reek
ADDED
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -22,7 +22,7 @@ in a queue for gem. Once the received message is decoded and returned through th
|
|
22
22
|
|
23
23
|
### Installation
|
24
24
|
|
25
|
-
Use
|
25
|
+
Use rubygem for installing gem in your application. Add in your Gemfile
|
26
26
|
```ruby
|
27
27
|
gem 'ruby_rabbitmq_janus'
|
28
28
|
```
|
@@ -31,6 +31,29 @@ gem 'ruby_rabbitmq_janus'
|
|
31
31
|
|
32
32
|
If you want used a customize configuration see [ruby-rabbitmq-janus.yml](config/default.md)
|
33
33
|
|
34
|
+
Use generator for complete installation :
|
35
|
+
```ruby
|
36
|
+
rails g -h
|
37
|
+
RubyRabbitmqJanus:
|
38
|
+
ruby_rabbitmq_janus:configuration
|
39
|
+
# Generate a custom configuration file.
|
40
|
+
|
41
|
+
ruby_rabbitmq_janus:default_request
|
42
|
+
# Copy base request file sending to janus in application. It's necessary if you want add your request.
|
43
|
+
|
44
|
+
ruby_rabbitmq_janus:initializer
|
45
|
+
# Generate a initializer to this gem for rails application.
|
46
|
+
|
47
|
+
ruby_rabbitmq_janus:create_request
|
48
|
+
# Create an request to json format for RubyRabbitmqJanus transaction.
|
49
|
+
```
|
50
|
+
|
51
|
+
For create an new request is simple. Use a command generator :
|
52
|
+
```ruby
|
53
|
+
rails g ruby_rabbitmq_janus:create_request test info 'transaction:<string>,body:{plugins:false}'
|
54
|
+
create config/requests/test/info.json
|
55
|
+
```
|
56
|
+
|
34
57
|
### Usage
|
35
58
|
|
36
59
|
#### Usage with synchronous request
|
@@ -106,7 +129,22 @@ bundle exec rspec
|
|
106
129
|
```
|
107
130
|
|
108
131
|
TIPS: for rspec install janus and rabbitmq server configured by default for user
|
109
|
-
|
132
|
+
rabbitmq and use plugin echotest for janus server.
|
133
|
+
|
134
|
+
Use tags for rspec :
|
135
|
+
|
136
|
+
| type | name |
|
137
|
+
| --------------- | --------------- |
|
138
|
+
| request | attach |
|
139
|
+
| | create |
|
140
|
+
| | detach |
|
141
|
+
| | info |
|
142
|
+
| | test |
|
143
|
+
| level | base |
|
144
|
+
| | admin |
|
145
|
+
| config | rabbit |
|
146
|
+
| | log |
|
147
|
+
| | config |
|
110
148
|
|
111
149
|
### Documentation
|
112
150
|
|
data/config/default.md
CHANGED
@@ -1,27 +1,43 @@
|
|
1
1
|
# RabbitMQ server info
|
2
2
|
|
3
|
-
The configuration file contains
|
4
|
-
|
5
|
-
The RabbitMQ server information for connection, and the queue used by janus.
|
3
|
+
The configuration file contains many parts.
|
6
4
|
|
7
5
|
By default the configuration file look like this :
|
8
6
|
|
9
7
|
```yaml
|
10
|
-
|
8
|
+
rabbit:
|
11
9
|
host: 'localhost'
|
12
10
|
port: 5672
|
13
11
|
vhost: '/'
|
14
12
|
user: 'guest'
|
15
|
-
|
13
|
+
pass: 'guest'
|
14
|
+
admin_pass: janusoverlord
|
16
15
|
|
17
16
|
queues:
|
18
17
|
queue_from: from-janus
|
19
18
|
queue_to: to-janus
|
19
|
+
admin:
|
20
|
+
queue_from: from-janus
|
21
|
+
queue_to: to-janus
|
22
|
+
|
23
|
+
janus:
|
24
|
+
plugins:
|
25
|
+
- janus.plugin.echotest
|
26
|
+
|
27
|
+
gem:
|
28
|
+
log:
|
29
|
+
level: WARN
|
30
|
+
session:
|
31
|
+
keepalive: 45
|
32
|
+
thread:
|
33
|
+
enable: false
|
34
|
+
number: 1
|
20
35
|
```
|
21
36
|
|
22
37
|
## Customize
|
23
38
|
For customizing a configuration add a yml file in your rails project in
|
24
|
-
`config/ruby-rabbitmq-janus.yml
|
39
|
+
`config/ruby-rabbitmq-janus.yml`, or use rails generator with command `rails generate
|
40
|
+
ruby_rabbitmq_janus:configuration`.
|
25
41
|
|
26
42
|
## Ressources
|
27
43
|
* [Configuration of RabbitMQ](https://www.rabbitmq.com/configure.html#config-items)
|
data/config/default.yml
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
#
|
2
|
-
|
1
|
+
# Rabbit information connection
|
2
|
+
rabbit:
|
3
3
|
# Precise RabbitMQ host - Default 'localhost'
|
4
4
|
host: localhost
|
5
|
-
# Precise RabbitMQ port - Default '
|
5
|
+
# Precise RabbitMQ port - Default '5672'
|
6
6
|
port: 5672
|
7
7
|
# Precise RabbitMQ vhost - Default '/'
|
8
8
|
vhost: /
|
9
9
|
# Precise RabbitMQ user - Default 'guest'
|
10
10
|
user: guest
|
11
11
|
# Precise RabbitMQ password - Default 'guest'
|
12
|
-
|
12
|
+
pass: guest
|
13
|
+
# Password for admin request
|
14
|
+
admin_pass: janusoverlord
|
13
15
|
|
14
16
|
# RabbitMQ Queue information
|
15
17
|
queues:
|
@@ -17,6 +19,10 @@ queues:
|
|
17
19
|
queue_from: from-janus
|
18
20
|
# Queue sending a message for janus server
|
19
21
|
queue_to: to-janus
|
22
|
+
# Queues for admin janus
|
23
|
+
admin:
|
24
|
+
queue_from: from-janus-admin
|
25
|
+
queue_to: to-janus-admin
|
20
26
|
|
21
27
|
# Janus plugin used
|
22
28
|
janus:
|
@@ -26,6 +32,18 @@ janus:
|
|
26
32
|
|
27
33
|
# Options gem
|
28
34
|
gem:
|
29
|
-
# Option for
|
35
|
+
# Option for logs
|
30
36
|
log:
|
31
|
-
level
|
37
|
+
# Define level to log
|
38
|
+
# UNKNOW, FATAL, ERROR, WARN, INFO, DEBUG
|
39
|
+
level: INFO
|
40
|
+
# Option for sessions
|
41
|
+
session:
|
42
|
+
# Define time to send a keepalive message in seconds
|
43
|
+
keepalive: 45
|
44
|
+
# Option for used multi thread
|
45
|
+
thread:
|
46
|
+
# Boolean for activate options thread
|
47
|
+
enable: false
|
48
|
+
# Number of core
|
49
|
+
number: 1
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Module contains all lib to this gem
|
4
|
+
module RubyRabbitmqJanus
|
5
|
+
# Module for generators
|
6
|
+
module Generators
|
7
|
+
# Create an class for generate a custom configuration file
|
8
|
+
class ConfigurationGenerator < Rails::Generators::Base
|
9
|
+
desc 'Generate a custom configuration file.'
|
10
|
+
|
11
|
+
# Define root path for original file a copied
|
12
|
+
def self.source_root
|
13
|
+
root_path = File.realpath(File.join(File.dirname(__FILE__), '..', '..', '..'))
|
14
|
+
@_rrj_source_root ||= File.join(root_path, 'config')
|
15
|
+
end
|
16
|
+
|
17
|
+
# Copy a default configuration in config folder to Rails app
|
18
|
+
def copy_configuration
|
19
|
+
template 'default.yml', 'config/ruby-rabbitmq-janus.yml'
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# Override String class
|
4
|
+
class String
|
5
|
+
# Character used for delimited an line
|
6
|
+
SEPARATOR_LINE = ','
|
7
|
+
# Character used for delimited an key and this value
|
8
|
+
SEPARATOR_KEY_VALUE = ':'
|
9
|
+
|
10
|
+
# Converting a string with a format special to hash
|
11
|
+
def converting_to_hash
|
12
|
+
hash = {}
|
13
|
+
split(SEPARATOR_LINE).each do |couple_hash|
|
14
|
+
hash.merge! HashString.new(couple_hash.split(SEPARATOR_KEY_VALUE)).convert_in_hash
|
15
|
+
end
|
16
|
+
hash
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
# Create an hash with an array
|
21
|
+
class HashString
|
22
|
+
# Initialize an array
|
23
|
+
def initialize(string_array)
|
24
|
+
@array = string_array
|
25
|
+
@hash = {}
|
26
|
+
end
|
27
|
+
|
28
|
+
# Create and return an hash
|
29
|
+
def convert_in_hash
|
30
|
+
@hash[@array[0]] = test_string_hash
|
31
|
+
@hash
|
32
|
+
end
|
33
|
+
|
34
|
+
private
|
35
|
+
|
36
|
+
# Test if string is hash
|
37
|
+
def test_string_hash
|
38
|
+
value.include?('{') ? HashString.new(format_hash_string).convert_in_hash : value
|
39
|
+
end
|
40
|
+
|
41
|
+
# Transform string to hash
|
42
|
+
def format_hash_string
|
43
|
+
@array.drop(1).join(':').sub('{', '').sub('}', '').split(String::SEPARATOR_KEY_VALUE)
|
44
|
+
end
|
45
|
+
|
46
|
+
# Return the value for hash object
|
47
|
+
def value
|
48
|
+
@array[1]
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
module RubyRabbitmqJanus
|
53
|
+
module Generators
|
54
|
+
# Create an class for generate a json request
|
55
|
+
class CreateRequestGenerator < Rails::Generators::Base
|
56
|
+
desc 'Create an request to json format for RubyRabbitmqJanus.'
|
57
|
+
argument :type_name, type: :string, default: ''
|
58
|
+
argument :janus_type, type: :string, default: ''
|
59
|
+
argument :content, type: :string, default: ''
|
60
|
+
|
61
|
+
# Create an file to json format in folder 'config/request/' to you Rails apps
|
62
|
+
def create_request
|
63
|
+
create_file file_json, write_json
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
# Create a path and name file
|
69
|
+
def file_json
|
70
|
+
base_file = type_name.empty? ? 'config/requests' : create_folder?(type_name)
|
71
|
+
"#{base_file}/#{janus_type}.json"
|
72
|
+
end
|
73
|
+
|
74
|
+
# Convert a string to hash and write in json file
|
75
|
+
def write_json
|
76
|
+
hash = {}
|
77
|
+
hash['janus'] = janus_type
|
78
|
+
hash.merge!(content.converting_to_hash)
|
79
|
+
JSON.pretty_generate(hash)
|
80
|
+
end
|
81
|
+
|
82
|
+
# Test if folder is exist and created if necessary
|
83
|
+
def create_folder?(folder_name)
|
84
|
+
path_folder = "config/requests/#{folder_name}"
|
85
|
+
Dir.mkdir path_folder unless File.exist?(path_folder)
|
86
|
+
path_folder
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
module Generators
|
5
|
+
# Create an class for generate who copy a default request
|
6
|
+
class DefaultRequestGenerator < Rails::Generators::Base
|
7
|
+
desc 'Copy base request file sending to janus in application.'
|
8
|
+
|
9
|
+
# Define root path for original file a copied
|
10
|
+
def self.source_root
|
11
|
+
root_path = File.realpath(File.join(File.dirname(__FILE__), '..', '..', '..'))
|
12
|
+
@_rrj_source_root ||= File.join(root_path, 'config')
|
13
|
+
end
|
14
|
+
|
15
|
+
# Copy default request in Rails app
|
16
|
+
def copy_default_request
|
17
|
+
directory 'requests', 'config/requests'
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
module Generators
|
5
|
+
# Create an class for generate a initializer
|
6
|
+
class InitializerGenerator < Rails::Generators::Base
|
7
|
+
desc 'Generate a initializer to this gem for rails application.'
|
8
|
+
|
9
|
+
# Create an initializer
|
10
|
+
def copy_initializer
|
11
|
+
initializer 'ruby_rabbitmq_janus.rb' do
|
12
|
+
"# frozen_string_literal: true\n\n::RRJ = RubyRabbitmqJanus::RRJ.new"
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
module Errors
|
5
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
6
|
+
# Define an error if the configuration file is not here
|
7
|
+
class ConfigFileNotFound < Errors::RRJError
|
8
|
+
def initialize(file)
|
9
|
+
super "Error for configuration file (#{file}), does on exist.", :error
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
14
|
+
# Define and error if rubrik level is not present
|
15
|
+
class LevelNotDefine < Errors::RRJError
|
16
|
+
def initialize
|
17
|
+
super 'Error in configuration file : option level is not present.', :warn
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
# Define all error in gem
|
5
|
+
module Errors
|
6
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
7
|
+
# Define errors to gems
|
8
|
+
class RRJError < StandardError
|
9
|
+
def initialize(message, level)
|
10
|
+
super(message)
|
11
|
+
Tools::Log.instance_method(level).bind(Tools::Log.instance).call(message)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
16
|
+
# Define an exception if gem dont initialize correctly
|
17
|
+
class RRJErrorInit < RRJError
|
18
|
+
def initialize(message)
|
19
|
+
super "Gem is not instanciate correctly : #{message}", :fatal
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
24
|
+
# Define an error if method message_post given an exception
|
25
|
+
class RRJErrorPost < RRJError
|
26
|
+
def initialize(message)
|
27
|
+
super "Post message is failed : #{message}", :fatal
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
32
|
+
# Define an error if method transation given an exception
|
33
|
+
class RRJErrorTransaction < RRJError
|
34
|
+
def initialize(message)
|
35
|
+
super "Transaction is failed : #{message}", :fatal
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
40
|
+
# Define an error if method start_handle given an exception
|
41
|
+
class RRJErrorHandle < RRJError
|
42
|
+
def initialize(message)
|
43
|
+
super "Transaction handle is failed : #{message}", :fatal
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
require 'rrj/errors/janus'
|
50
|
+
require 'rrj/errors/janus_message'
|
51
|
+
require 'rrj/errors/janus_response'
|
52
|
+
require 'rrj/errors/janus_transaction'
|
53
|
+
|
54
|
+
require 'rrj/errors/config'
|
55
|
+
require 'rrj/errors/rabbit'
|
56
|
+
require 'rrj/errors/request'
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
# :reek:FeatureEnvy
|
3
|
+
|
4
|
+
module RubyRabbitmqJanus
|
5
|
+
module Errors
|
6
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
7
|
+
# Define errors to message sending and response to janus
|
8
|
+
class JanusError < RRJError
|
9
|
+
def initialize(message)
|
10
|
+
super "[JANUS] #{message}", :fatal
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module RubyRabbitmqJanus
|
4
|
+
module Errors
|
5
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
6
|
+
# Define an exception for janus message class
|
7
|
+
class JanusMessage < JanusError
|
8
|
+
def initialize(message)
|
9
|
+
super "[Message] Error create : #{message}"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
14
|
+
# Define an exception for janus message to_json
|
15
|
+
class JanusMessageJson < JanusError
|
16
|
+
def initialize(message)
|
17
|
+
super "[Message] Error transform to json : #{message}"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
22
|
+
# Define an exception for janus message to_nice_json
|
23
|
+
class JanusMessagePrettyJson < JanusError
|
24
|
+
def initialize(message)
|
25
|
+
super "[Message] Error transform to pretty json : #{message}"
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
30
|
+
# Define an exception for janus message to_hash
|
31
|
+
class JanusMessageHash < JanusError
|
32
|
+
def initialize(message)
|
33
|
+
super "[Message] Error transform to hash : #{message}"
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
# @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
|
38
|
+
# Define an exception for janus message option
|
39
|
+
class JanusMessageOption < JanusError
|
40
|
+
def initialize(message)
|
41
|
+
super "[Message] Error options to message : #{message}"
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|