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.
Files changed (115) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +14 -3
  3. data/Rakefile +98 -0
  4. data/config/default.md +6 -3
  5. data/config/default.yml +7 -1
  6. data/lib/generators/ruby_rabbitmq_janus/install_generator.rb +3 -0
  7. data/lib/generators/ruby_rabbitmq_janus/migration_generator.rb +30 -0
  8. data/lib/generators/ruby_rabbitmq_janus/templates/migration.rb +14 -0
  9. data/lib/rrj/admin.rb +2 -0
  10. data/lib/rrj/errors/base/admin.rb +24 -0
  11. data/lib/rrj/errors/base/base.rb +5 -0
  12. data/lib/rrj/errors/base/init.rb +46 -0
  13. data/lib/rrj/errors/base/task.rb +32 -0
  14. data/lib/rrj/errors/error.rb +4 -3
  15. data/lib/rrj/errors/janus/janus.rb +20 -7
  16. data/lib/rrj/errors/janus/messages/admin.rb +33 -0
  17. data/lib/rrj/errors/janus/messages/message.rb +51 -0
  18. data/lib/rrj/errors/janus/messages/standard.rb +33 -0
  19. data/lib/rrj/errors/janus/processus/concurency.rb +23 -0
  20. data/lib/rrj/errors/janus/processus/event.rb +30 -0
  21. data/lib/rrj/errors/janus/processus/keepalive.rb +33 -0
  22. data/lib/rrj/errors/janus/responses/admin.rb +39 -0
  23. data/lib/rrj/errors/janus/responses/event.rb +46 -0
  24. data/lib/rrj/errors/janus/responses/response.rb +44 -0
  25. data/lib/rrj/errors/janus/responses/standard.rb +58 -0
  26. data/lib/rrj/errors/janus/transactions/admin.rb +37 -0
  27. data/lib/rrj/errors/janus/transactions/handle.rb +52 -0
  28. data/lib/rrj/errors/janus/transactions/session.rb +38 -0
  29. data/lib/rrj/errors/janus/transactions/transaction.rb +23 -0
  30. data/lib/rrj/errors/rabbit/connect.rb +58 -0
  31. data/lib/rrj/errors/rabbit/propertie.rb +37 -0
  32. data/lib/rrj/errors/rabbit/publish/admin.rb +30 -0
  33. data/lib/rrj/errors/rabbit/publish/base_publisher.rb +23 -0
  34. data/lib/rrj/errors/rabbit/publish/exclusive.rb +31 -0
  35. data/lib/rrj/errors/rabbit/publish/listener.rb +30 -0
  36. data/lib/rrj/errors/rabbit/publish/non_exclusive.rb +31 -0
  37. data/lib/rrj/errors/rabbit/publish/publisher.rb +30 -0
  38. data/lib/rrj/errors/rabbit/rabbit.rb +14 -23
  39. data/lib/rrj/errors/tools/gem/cluster.rb +44 -0
  40. data/lib/rrj/errors/tools/gem/config.rb +89 -0
  41. data/lib/rrj/errors/tools/gem/log.rb +86 -0
  42. data/lib/rrj/errors/tools/gem/option.rb +37 -0
  43. data/lib/rrj/errors/tools/gem/request.rb +23 -0
  44. data/lib/rrj/errors/tools/replaces/replace.rb +30 -0
  45. data/lib/rrj/errors/tools/replaces/type.rb +30 -0
  46. data/lib/rrj/errors/tools/tools.rb +21 -1
  47. data/lib/rrj/info.rb +1 -1
  48. data/lib/rrj/init.rb +22 -4
  49. data/lib/rrj/janus/messages/admin.rb +9 -4
  50. data/lib/rrj/janus/messages/message.rb +20 -9
  51. data/lib/rrj/janus/messages/standard.rb +8 -2
  52. data/lib/rrj/janus/processus/concurrency.rb +2 -0
  53. data/lib/rrj/janus/processus/event.rb +8 -0
  54. data/lib/rrj/janus/processus/keepalive.rb +15 -23
  55. data/lib/rrj/janus/responses/admin.rb +6 -0
  56. data/lib/rrj/janus/responses/event.rb +8 -0
  57. data/lib/rrj/janus/responses/response.rb +8 -11
  58. data/lib/rrj/janus/responses/standard.rb +12 -0
  59. data/lib/rrj/janus/transactions/admin.rb +6 -0
  60. data/lib/rrj/janus/transactions/handle.rb +25 -3
  61. data/lib/rrj/janus/transactions/session.rb +6 -0
  62. data/lib/rrj/janus/transactions/transaction.rb +3 -9
  63. data/lib/rrj/models/active_record.rb +14 -0
  64. data/lib/rrj/models/concerns/janus_instance_concern.rb +47 -0
  65. data/lib/rrj/models/mongoid.rb +19 -0
  66. data/lib/rrj/rabbit/connect.rb +12 -8
  67. data/lib/rrj/rabbit/propertie.rb +23 -6
  68. data/lib/rrj/rabbit/publish/admin.rb +4 -0
  69. data/lib/rrj/rabbit/publish/base_publisher.rb +2 -1
  70. data/lib/rrj/rabbit/publish/exclusive.rb +4 -0
  71. data/lib/rrj/rabbit/publish/listener.rb +6 -0
  72. data/lib/rrj/rabbit/publish/non_exclusive.rb +4 -0
  73. data/lib/rrj/rabbit/publish/publisher.rb +4 -4
  74. data/lib/rrj/railtie.rb +15 -0
  75. data/lib/rrj/task.rb +51 -0
  76. data/lib/rrj/tools/gem/cluster.rb +65 -0
  77. data/lib/rrj/tools/gem/config.rb +38 -6
  78. data/lib/rrj/tools/gem/log.rb +24 -4
  79. data/lib/rrj/tools/gem/option.rb +21 -17
  80. data/lib/rrj/tools/gem/requests.rb +11 -7
  81. data/lib/rrj/tools/replaces/replace.rb +4 -0
  82. data/lib/rrj/tools/replaces/type.rb +4 -0
  83. data/lib/rrj/tools/tools.rb +1 -0
  84. data/lib/ruby_rabbitmq_janus.rb +3 -0
  85. data/lib/tasks/delete_all_instance.rake +12 -0
  86. data/spec/request/admin/request_handle_info_spec.rb +4 -3
  87. data/spec/request/admin/request_handles_spec.rb +4 -3
  88. data/spec/request/peer/request_trickle_spec.rb +1 -1
  89. data/spec/rrj/rabbit/propertie_spec.rb +37 -2
  90. data/spec/rrj/tools/gem/rrj_cluster_spec.rb +26 -0
  91. data/spec/rrj/tools/gem/rrj_config_spec.rb +78 -0
  92. data/spec/rrj/tools/gem/rrj_log_spec.rb +55 -0
  93. data/spec/rrj/tools/{replace_admin_spec.rb → replace/replace_admin_spec.rb} +0 -0
  94. data/spec/rrj/tools/{replace_handle_spec.rb → replace/replace_handle_spec.rb} +0 -0
  95. data/spec/rrj/tools/{replace_session_spec.rb → replace/replace_session_spec.rb} +0 -0
  96. data/spec/rrj/tools/{replace_spec.rb → replace/replace_spec.rb} +0 -0
  97. data/spec/rrj/tools/{type_spec.rb → replace/type_spec.rb} +0 -0
  98. data/spec/spec_helper.rb +33 -2
  99. data/spec/support/examples_config.rb +10 -0
  100. data/spec/support/examples_message.rb +0 -2
  101. data/spec/support/examples_request.rb +4 -4
  102. data/spec/support/schemas/config/config.json +4 -2
  103. data/spec/support/schemas/config/rabbit_options.json +1 -1
  104. data/spec/support/schemas/config/rabbit_options2.json +13 -0
  105. data/spec/support/schemas/config/rabbit_options_admin.json +1 -1
  106. data/spec/support/schemas/config/rabbit_options_admin2.json +13 -0
  107. metadata +98 -17
  108. data/lib/rrj/errors/init.rb +0 -69
  109. data/lib/rrj/errors/janus/janus_message.rb +0 -53
  110. data/lib/rrj/errors/janus/janus_processus_keepalive.rb +0 -48
  111. data/lib/rrj/errors/janus/janus_response.rb +0 -89
  112. data/lib/rrj/errors/janus/janus_transaction.rb +0 -29
  113. data/lib/rrj/errors/tools/config.rb +0 -43
  114. data/spec/rrj/rrj_config_spec.rb +0 -67
  115. data/spec/rrj/rrj_log_spec.rb +0 -16
@@ -0,0 +1,51 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for all error in Janus::Message
7
+ class BaseMessage < BaseJanus
8
+ def initialize(message, level)
9
+ super "[Message]#{message}", level
10
+ end
11
+ end
12
+
13
+ module Message
14
+ # Error for Janus::Message#initialize
15
+ class Initializer < RubyRabbitmqJanus::Errors::Janus::BaseMessage
16
+ def initialize
17
+ super 'Error in initalizer'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Message#to_json
22
+ class ToJson < RubyRabbitmqJanus::Errors::Janus::BaseMessage
23
+ def initialize
24
+ super 'Error transform to json'
25
+ end
26
+ end
27
+
28
+ # Error for Janus::Message#to_nice_json
29
+ class ToNiceJson < RubyRabbitmqJanus::Errors::Janus::BaseMessage
30
+ def initialize
31
+ super 'Error transform to nice json'
32
+ end
33
+ end
34
+
35
+ # Error for Janus::Message#to_hash
36
+ class ToHash < RubyRabbitmqJanus::Errors::Janus::BaseMessage
37
+ def initialize
38
+ super 'Error transform to hash'
39
+ end
40
+ end
41
+
42
+ # Error for Janus::Message#correlation
43
+ class Correlation < RubyRabbitmqJanus::Errors::Janus::BaseMessage
44
+ def initialize
45
+ super 'Error return correlation information'
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
@@ -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::Message
10
+ class BaseMessageStandard < BaseMessage
11
+ def initialize(message, level = :fatal)
12
+ super "[Standard] #{message}", level
13
+ end
14
+ end
15
+
16
+ module MessageStandard
17
+ # Error for Janus::MessageStandard#initialize
18
+ class Initializer < BaseMessageStandard
19
+ def initialize
20
+ super 'Error in initializer'
21
+ end
22
+ end
23
+
24
+ # Error for Janus::MessageStandard#option
25
+ class Option < BaseMessageStandard
26
+ def initialize
27
+ super 'Return properties message admin failed'
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for all error in Janus::Concurency class
7
+ class BaseConcurency < RubyRabbitmqJanus::Errors::BaseJanus
8
+ def initialize(message)
9
+ super "[Concurency] #{message}"
10
+ end
11
+ end
12
+
13
+ module Concurency
14
+ # Error for Janus::Concurency#initialize
15
+ class Initializer < RubyRabbitmqJanus::Errors::Janus::BaseConcurency
16
+ def initialize
17
+ super 'Error initialize concurency class'
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for all error in Janus::Concurency::Event class
7
+ class BaseEvent < RubyRabbitmqJanus::Errors::Janus::BaseConcurency
8
+ def initialize(message)
9
+ super "[Event] #{message}"
10
+ end
11
+ end
12
+
13
+ module Event
14
+ # Error for Janus::Concurency::Event#initialize
15
+ class Initializer < RubyRabbitmqJanus::Errors::Janus::BaseEvent
16
+ def initializer
17
+ super 'Error Event initializer'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Concurency::Event#run
22
+ class Run < RubyRabbitmqJanus::Errors::Janus::BaseEvent
23
+ def initializer
24
+ super 'Error running block code'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,33 @@
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 Janus
9
+ # Define a super class for all error in Janus::Concurency::Keepalive
10
+ class BaseKeepalive < RubyRabbitmqJanus::Errors::Janus::BaseConcurency
11
+ def initialize(message)
12
+ super "[Keepalive] #{message}"
13
+ end
14
+ end
15
+
16
+ module Keepalive
17
+ # Error for Janus::Concurency::Keepalive#initialize
18
+ class Initializer < RubyRabbitmqJanus::Errors::Janus::BaseKeepalive
19
+ def initializer
20
+ super 'Error keepalive initializer'
21
+ end
22
+ end
23
+
24
+ # Error for Janus::Concurency::Keepalive#session
25
+ class Session < RubyRabbitmqJanus::Errors::Janus::BaseKeepalive
26
+ def initializer
27
+ super 'Error return session number'
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
4
+
5
+ module RubyRabbitmqJanus
6
+ module Errors
7
+ module Janus
8
+ # Define a super class for all error in Janus::Responses::ResponseAdmin
9
+ class BaseResponseAdmin < RubyRabbitmqJanus::Errors::Janus::BaseResponse
10
+ def initialize(message)
11
+ super "[Admin] #{message}"
12
+ end
13
+ end
14
+
15
+ module ResponseAdmin
16
+ # Error for Janus::Responses::ResponseAdmin#sessions
17
+ class Sessions < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
18
+ def initializer
19
+ super 'Error sessions information reading'
20
+ end
21
+ end
22
+
23
+ # Error for Janus::Responses::ResponseAdmin#handles
24
+ class Handles < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
25
+ def initializer
26
+ super 'Error handles information reading'
27
+ end
28
+ end
29
+
30
+ # Error for Janus::Responses::ResponseAdmin#info
31
+ class Info < RubyRabbitmqJanus::Errors::Janus::BaseResponseAdmin
32
+ def initializer
33
+ super 'Error info information reading'
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ # @author VAILLANT Jeremy <jeremy.vaillant@dazzl.tv>
4
+
5
+ module RubyRabbitmqJanus
6
+ module Errors
7
+ module Janus
8
+ # Define a super class for all error in Janus::Responses::ResponseEvent
9
+ class BaseResponseEvent < RubyRabbitmqJanus::Errors::Janus::BaseResponse
10
+ def initialize(message)
11
+ super "[Event] #{message}"
12
+ end
13
+ end
14
+
15
+ module ResponseEvent
16
+ # Error for Janus::Responses::ResponseEvent#initialize
17
+ class Event < RubyRabbitmqJanus::Errors::Janus::BaseResponseEvent
18
+ def initializer
19
+ super 'Error janus information reading'
20
+ end
21
+ end
22
+
23
+ # Error for Janus::Responses::ResponseEvent#data
24
+ class Data < RubyRabbitmqJanus::Errors::Janus::BaseResponseEvent
25
+ def initializer
26
+ super 'Error plugin data information reading'
27
+ end
28
+ end
29
+
30
+ # Error for Janus::Responses::ResponseEvent#jsep
31
+ class Jsep < RubyRabbitmqJanus::Errors::Janus::BaseResponseEvent
32
+ def initializer
33
+ super 'Error JSEP information reading'
34
+ end
35
+ end
36
+
37
+ # Error for Janus::Responses::ResponseEvent#keys
38
+ class Keys < RubyRabbitmqJanus::Errors::Janus::BaseResponseEvent
39
+ def initializer
40
+ super 'Error session_id and sender information reading'
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for Janus::Responses::Response
7
+ class BaseResponse < RubyRabbitmqJanus::Errors::BaseJanus
8
+ def initialize(message, level = :fatal)
9
+ super "[Response] #{message}", level
10
+ end
11
+ end
12
+
13
+ module Response
14
+ # Error for Janus::Responses::Response#initialize
15
+ class Initializer < RubyRabbitmqJanus::Errors::Janus::BaseResponse
16
+ def initialize
17
+ super 'Error in intializer'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Responses::Response#to_json
22
+ class ToJson < RubyRabbitmqJanus::Errors::Janus::BaseResponse
23
+ def initialize
24
+ super 'Error transform response in json'
25
+ end
26
+ end
27
+
28
+ # Error for Janus::Responses::Response#to_nice_json
29
+ class ToNiceJson < RubyRabbitmqJanus::Errors::Janus::BaseResponse
30
+ def initialize
31
+ super 'Error transform response in nice json'
32
+ end
33
+ end
34
+
35
+ # Error for Janus::Responses::Response#to_hash
36
+ class ToHash < RubyRabbitmqJanus::Errors::Janus::BaseResponse
37
+ def initialize
38
+ super 'Error transform response in hash'
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,58 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for Janus::Responses::ResponseStandard
7
+ class BaseResponseStandard < BaseResponse
8
+ def initialize(message, level = :fatal)
9
+ super "[Response] #{message}", level
10
+ end
11
+ end
12
+
13
+ module ResponseStandard
14
+ # Error for Janus::Responses::ResponseStandard#initialize
15
+ class Session < BaseResponseStandard
16
+ def initialize
17
+ super 'Error reading response session (data_id in response)'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Responses::ResponseStandard#session_id
22
+ class SessionId < BaseResponseStandard
23
+ def initialize
24
+ super 'Error reading response session_id'
25
+ end
26
+ end
27
+
28
+ # Error for Janus::Responses::ResponseStandard#plugin
29
+ class Plugin < BaseResponseStandard
30
+ def initialize
31
+ super 'Error reading response plugin'
32
+ end
33
+ end
34
+
35
+ # Error for Janus::Responses::ResponseStandard#plugin_data
36
+ class PluginData < BaseResponseStandard
37
+ def initialize
38
+ super 'Error reading response plugin data'
39
+ end
40
+ end
41
+
42
+ # Error for Janus::Responses::ResponseStandard#data
43
+ class Data < BaseResponseStandard
44
+ def initialize
45
+ super 'Error reading response data'
46
+ end
47
+ end
48
+
49
+ # Error for Janus::Responses::ResponseStandard#sdp
50
+ class SDP < BaseResponseStandard
51
+ def initialize
52
+ super 'Error reading SDP (jsep > sdp in response)'
53
+ end
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for error in Janus::Transactions::TransactionAdmin
7
+ class BaseTransactionAdmin < BaseTransaction
8
+ def initialize(message, level = :fatal)
9
+ super "[Admin] #{message}", level
10
+ end
11
+ end
12
+
13
+ module TransactionAdmin
14
+ # Error for Janus::Transactions::TransactionAdmin#initialize
15
+ class Initialize < BaseTransactionAdmin
16
+ def initialize
17
+ super 'Error in initializer'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Transactions::TransactionAdmin#connect
22
+ class Connect < BaseTransactionAdmin
23
+ def initialize
24
+ super 'Error to connection RabbitMQ'
25
+ end
26
+ end
27
+
28
+ # Error for Janus::Transactions::TransactionAdmin#publish_message
29
+ class PublishMessage < BaseTransactionAdmin
30
+ def initialize
31
+ super 'Error for publishing message in RabbitMQ'
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Janus
6
+ # Define a super class for error in Janus::Transactions::TransactionHandle
7
+ class BaseTransactionHandle < BaseTransaction
8
+ def initialize(message, level = :fatal)
9
+ super "[Handle] #{message}", level
10
+ end
11
+ end
12
+
13
+ module TransactionHandle
14
+ # Error for Janus::Transactions::TransactionHandle#initialize
15
+ class Initialize < Errors::Janus::BaseTransactionHandle
16
+ def initialize
17
+ super 'Error in initializer'
18
+ end
19
+ end
20
+
21
+ # Error for Janus::Transactions::TransactionHandle#connect
22
+ class Connect < Errors::Janus::BaseTransactionHandle
23
+ def initialize
24
+ super 'Error for connect to RabbitMQ'
25
+ end
26
+ end
27
+
28
+ # Error for Janus::Transactions::TransactionHandle#publish_message
29
+ class PublishMessage < Errors::Janus::BaseTransactionHandle
30
+ def initialize
31
+ super 'Error for publishing message'
32
+ end
33
+ end
34
+
35
+ # Error for Janus::Transactions::TransactionHandle#detach
36
+ class Detach < Errors::Janus::BaseTransactionHandle
37
+ def initialize
38
+ super 'Error for sending message to type detach'
39
+ end
40
+ end
41
+
42
+ # Error for Janus::Transactions::TransactionHandle#detach_for_deleteing
43
+ class DetachForDeleting < Errors::Janus::BaseTransactionHandle
44
+ def initialize
45
+ super 'Error for sending message detach ' \
46
+ 'and update in database Janus instance'
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end