ruby_rabbitmq_janus 4.0.0.pre.1001132533 → 4.0.1.pre.1265140558
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -2
- data/lib/rrj/errors/rabbit/rabbit.rb +34 -32
- data/lib/rrj/info.rb +1 -1
- data/lib/rrj/rabbit/connect.rb +5 -4
- data/spec/spec_helper.rb +4 -1
- data/tmp/coverage/index.html +21519 -0
- metadata +3 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7bd366c773c87d7099fa5877216f8bdd053069dcc799bbd37d7b86d96297197
|
4
|
+
data.tar.gz: b0c402d3316c96117a3d7cde67206dec284b7ddf3c5d54faed6cfd9a80b96bb6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4c823626f3eac6a1ef486eac346862dbd64ce62f069068cce187242e48c5c4cf7e8971e3d6194ba56d0f0c7f89037fb99957c422470bd59abe0b3d4670e39fb7
|
7
|
+
data.tar.gz: 89a5c209d43f8c958d8444700859cdab404b01947f7e4b09e4b2eff2a6c72060d1cf019e7e3bd41a56988251951319e5dbab7d9f6b0f414b8e717d34037c4ffc
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
[![Linter](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/linter.yml/badge.svg)](https://github.com/dazzl-tv/ruby-rabbitmq-janus/actions/workflows/linter.yml)
|
4
4
|
[![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus)
|
5
5
|
[![Docs](https://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](https://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
|
6
|
-
[![Maintainability](https://api.codeclimate.com/v1/badges/
|
7
|
-
[![Test Coverage](https://api.codeclimate.com/v1/badges/
|
6
|
+
[![Maintainability](https://api.codeclimate.com/v1/badges/f1eda688803e829438a7/maintainability)](https://codeclimate.com/github/dazzl-tv/ruby-rabbitmq-janus/maintainability)
|
7
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/f1eda688803e829438a7/test_coverage)](https://codeclimate.com/github/dazzl-tv/ruby-rabbitmq-janus/test_coverage)
|
8
8
|
[![Known Vulnerabilities](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus/badge.svg)](https://snyk.io/test/github/dazzl-tv/ruby-rabbitmq-janus)
|
9
9
|
|
10
10
|
Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
|
@@ -2,50 +2,52 @@
|
|
2
2
|
|
3
3
|
module RubyRabbitmqJanus
|
4
4
|
module Errors
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
module Rabbit
|
6
|
+
# Define a super class for all error in module Rabbit
|
7
|
+
class Base < RRJError
|
8
|
+
def initialize(message, level = :fatal)
|
9
|
+
super "[Rabbit]#{message}", level
|
10
|
+
end
|
9
11
|
end
|
10
|
-
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
13
|
+
module Connect
|
14
|
+
# Error when transaction hs no block
|
15
|
+
class MissingAction < RubyRabbitmqJanus::Errors::Rabbit::Base
|
16
|
+
def initialize
|
17
|
+
super 'Transaction failed, missing block'
|
18
|
+
end
|
17
19
|
end
|
18
|
-
end
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
21
|
+
# Error When transaction timeout
|
22
|
+
class TransactionTimeout < RubyRabbitmqJanus::Errors::Rabbit::Base
|
23
|
+
def initialize(error)
|
24
|
+
super error
|
25
|
+
end
|
24
26
|
end
|
25
27
|
end
|
26
|
-
end
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
29
|
+
module Listener
|
30
|
+
# Error when response is empty
|
31
|
+
class ResponseEmpty < RubyRabbitmqJanus::Errors::Rabbit::Base
|
32
|
+
def initialize(response)
|
33
|
+
super "Response is empty ! (#{response})"
|
34
|
+
end
|
33
35
|
end
|
34
|
-
end
|
35
36
|
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
# Error when response is nil
|
38
|
+
class ResponseNil < RubyRabbitmqJanus::Errors::Rabbit::Base
|
39
|
+
def initialize(response)
|
40
|
+
super "Response is nil ! (#{response})"
|
41
|
+
end
|
40
42
|
end
|
41
43
|
end
|
42
|
-
end
|
43
44
|
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
45
|
+
module Publisher
|
46
|
+
# Error when correlation string is not equal
|
47
|
+
class TestCorrelation < RubyRabbitmqJanus::Errors::Rabbit::Base
|
48
|
+
def initialize(message, propertie)
|
49
|
+
super "Correlation doesn't equal (msg: #{message}) != (prp: #{propertie})"
|
50
|
+
end
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
data/lib/rrj/info.rb
CHANGED
data/lib/rrj/rabbit/connect.rb
CHANGED
@@ -15,7 +15,8 @@ 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 RubyRabbitmqJanus::Errors::Connect::MissingAction
|
18
|
+
raise RubyRabbitmqJanus::Errors::Rabbit::Connect::MissingAction \
|
19
|
+
unless block
|
19
20
|
|
20
21
|
response = nil
|
21
22
|
|
@@ -23,7 +24,7 @@ module RubyRabbitmqJanus
|
|
23
24
|
response = transaction_long(&block)
|
24
25
|
end
|
25
26
|
rescue Timeout::Error
|
26
|
-
raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
|
27
|
+
raise RubyRabbitmqJanus::Errors::Rabbit::Connect::TransactionTimeout, \
|
27
28
|
'The "Short transaction" have raised Timeout exception.'
|
28
29
|
ensure
|
29
30
|
close
|
@@ -32,7 +33,7 @@ module RubyRabbitmqJanus
|
|
32
33
|
|
33
34
|
# Create an transaction with rabbitmq and not close
|
34
35
|
def transaction_long
|
35
|
-
raise RubyRabbitmqJanus::Errors::Connect::MissingAction \
|
36
|
+
raise RubyRabbitmqJanus::Errors::Rabbit::Connect::MissingAction \
|
36
37
|
unless block_given?
|
37
38
|
|
38
39
|
Timeout.timeout(60) do
|
@@ -40,7 +41,7 @@ module RubyRabbitmqJanus
|
|
40
41
|
yield
|
41
42
|
end
|
42
43
|
rescue Timeout::Error
|
43
|
-
raise RubyRabbitmqJanus::Errors::Connect::TransactionTimeout, \
|
44
|
+
raise RubyRabbitmqJanus::Errors::Rabbit::Connect::TransactionTimeout, \
|
44
45
|
'The "Long transaction" have raised Timeout exception.'
|
45
46
|
end
|
46
47
|
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
require 'simplecov'
|
4
|
+
require 'simplecov_json_formatter'
|
5
|
+
|
6
|
+
SimpleCov.start
|
7
|
+
SimpleCov.formatter = SimpleCov::Formatter::JSONFormatter
|
4
8
|
|
5
9
|
# Load gems dependencies
|
6
10
|
require 'bundler/setup'
|
@@ -16,7 +20,6 @@ else
|
|
16
20
|
require 'active_record'
|
17
21
|
require 'database_cleaner/active_record'
|
18
22
|
end
|
19
|
-
# require ENV['MONGO'].match?('true') ? 'mongoid' : 'active_record'
|
20
23
|
require 'timeout'
|
21
24
|
|
22
25
|
# Load gem RubyRabbitmqJanus
|