ruby_rabbitmq_janus 2.5.1 → 2.6.0.pre.226

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/bin/ruby_rabbitmq_janus +67 -0
  4. data/config/default.md +3 -0
  5. data/config/default.yml +6 -0
  6. data/lib/rrj/binary.rb +56 -0
  7. data/lib/rrj/errors/rabbit/base_event.rb +21 -0
  8. data/lib/rrj/errors/rabbit/listener/base.rb +29 -0
  9. data/lib/rrj/errors/rabbit/listener/from.rb +17 -0
  10. data/lib/rrj/errors/rabbit/listener/from_admin.rb +17 -0
  11. data/lib/rrj/errors/rabbit/listener/janus_instance.rb +17 -0
  12. data/lib/rrj/errors/rabbit/publisher/admin.rb +32 -0
  13. data/lib/rrj/errors/rabbit/publisher/base.rb +31 -0
  14. data/lib/rrj/errors/rabbit/publisher/exclusive.rb +33 -0
  15. data/lib/rrj/errors/rabbit/publisher/janus_instance.rb +23 -0
  16. data/lib/rrj/errors/rabbit/publisher/keepalive.rb +17 -0
  17. data/lib/rrj/errors/rabbit/publisher/non_exclusive.rb +33 -0
  18. data/lib/rrj/errors/rabbit/rabbit.rb +12 -6
  19. data/lib/rrj/info.rb +6 -5
  20. data/lib/rrj/init.rb +2 -2
  21. data/lib/rrj/janus/messages/message.rb +1 -1
  22. data/lib/rrj/janus/processus/event.rb +1 -1
  23. data/lib/rrj/janus/processus/keepalive/keepalive_thread.rb +3 -2
  24. data/lib/rrj/janus/responses/janus_instance.rb +28 -0
  25. data/lib/rrj/janus/responses/response.rb +1 -1
  26. data/lib/rrj/janus/transactions/admin.rb +1 -1
  27. data/lib/rrj/janus/transactions/handle.rb +1 -1
  28. data/lib/rrj/janus/transactions/transaction.rb +2 -2
  29. data/lib/rrj/models/concerns/janus_instance_callbacks.rb +9 -5
  30. data/lib/rrj/models/concerns/janus_instance_methods.rb +12 -0
  31. data/lib/rrj/rabbit/base_event.rb +47 -0
  32. data/lib/rrj/rabbit/connect.rb +12 -12
  33. data/lib/rrj/rabbit/{publish/listener.rb → listener/base.rb} +16 -18
  34. data/lib/rrj/rabbit/listener/from.rb +30 -0
  35. data/lib/rrj/rabbit/{publish/listener_admin.rb → listener/from_admin.rb} +6 -4
  36. data/lib/rrj/rabbit/listener/janus_instance.rb +36 -0
  37. data/lib/rrj/rabbit/{publish/publisher_admin.rb → publisher/admin.rb} +5 -10
  38. data/lib/rrj/rabbit/{publish/publisher.rb → publisher/base.rb} +10 -8
  39. data/lib/rrj/rabbit/{publish → publisher}/exclusive.rb +3 -3
  40. data/lib/rrj/rabbit/publisher/janus_instance.rb +27 -0
  41. data/lib/rrj/rabbit/{publish → publisher}/keepalive.rb +4 -2
  42. data/lib/rrj/rabbit/{publish → publisher}/non_exclusive.rb +3 -7
  43. data/lib/rrj/rabbit/rabbit.rb +1 -1
  44. data/lib/rrj/tools/gem/cluster.rb +0 -17
  45. data/lib/rrj/tools/gem/config.rb +9 -0
  46. data/lib/rrj/tools/gem/log.rb +3 -4
  47. data/lib/rrj/tools/gem/option.rb +2 -12
  48. data/lib/rrj/tools/replaces/admin.rb +4 -4
  49. data/lib/rrj/tools/replaces/handle.rb +6 -6
  50. data/lib/rrj/tools/replaces/replace.rb +6 -6
  51. data/lib/rrj/tools/replaces/session.rb +4 -4
  52. data/spec/factories/janus_instance.rb +1 -1
  53. data/spec/request/admin/request_allow_token_spec.rb +1 -0
  54. data/spec/request/admin/request_disallow_token_spec.rb +1 -0
  55. data/spec/request/admin/request_handle_info_spec.rb +1 -0
  56. data/spec/request/admin/request_list_handles_spec.rb +1 -0
  57. data/spec/request/admin/request_list_sessions_spec.rb +1 -0
  58. data/spec/request/admin/request_start_pcap_spec.rb +1 -0
  59. data/spec/request/admin/request_start_text2pcap_spec.rb +1 -0
  60. data/spec/request/admin/request_stop_pcap_spec.rb +1 -0
  61. data/spec/request/admin/request_stop_text2pcap_spec.rb +1 -0
  62. data/spec/request/base/request_attach_spec.rb +1 -1
  63. data/spec/request/base/request_create_spec.rb +2 -2
  64. data/spec/request/base/request_destroy_spec.rb +1 -1
  65. data/spec/request/base/request_detach_spec.rb +1 -1
  66. data/spec/request/base/request_info_spec.rb +2 -2
  67. data/spec/request/base/request_keepalive_spec.rb +1 -1
  68. data/spec/request/peer/request_offer_spec.rb +1 -1
  69. data/spec/request/peer/request_trickle_spec.rb +1 -1
  70. data/spec/request/peer/request_trickles_spec.rb +1 -1
  71. data/spec/rrj/{rrj_spec.rb → ruby_rabbitmq_janus_spec.rb} +21 -11
  72. data/spec/{thread/concurencies_spec.rb → ruby_rabbitmq_janus/janus/concurrencies/concurrency_spec.rb} +1 -1
  73. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_initializer_spec.rb +3 -2
  74. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_thread_spec.rb +3 -3
  75. data/spec/{thread → ruby_rabbitmq_janus/janus/concurrencies}/keepalive_timer_spec.rb +1 -1
  76. data/spec/{rrj/messages/messages_admin_spec.rb → ruby_rabbitmq_janus/janus/messages/admin_spec.rb} +1 -1
  77. data/spec/{rrj/messages/messages_message_spec.rb → ruby_rabbitmq_janus/janus/messages/message_spec.rb} +2 -1
  78. data/spec/{rrj/messages/messages_standard_spec.rb → ruby_rabbitmq_janus/janus/messages/standard_spec.rb} +1 -1
  79. data/spec/{rrj/responses/responses_admin_spec.rb → ruby_rabbitmq_janus/janus/responses/admin_spec.rb} +1 -1
  80. data/spec/{rrj/responses/responses_event_spec.rb → ruby_rabbitmq_janus/janus/responses/event_spec.rb} +3 -2
  81. data/spec/{rrj/responses/responses_response_spec.rb → ruby_rabbitmq_janus/janus/responses/response_spec.rb} +3 -3
  82. data/spec/{rrj/responses/responses_standard_spec.rb → ruby_rabbitmq_janus/janus/responses/standard_spec.rb} +4 -3
  83. data/spec/{rrj → ruby_rabbitmq_janus}/models/janus_instance_definition_spec.rb +2 -2
  84. data/spec/{rrj/models/janus_instance_transaction_spec.rb → ruby_rabbitmq_janus/models/janus_instance_spec.rb} +10 -9
  85. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/connect_spec.rb +1 -1
  86. data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +15 -0
  87. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_2_spec.rb +3 -3
  88. data/spec/{rrj → ruby_rabbitmq_janus}/rabbit/propertie_spec.rb +3 -3
  89. data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +12 -0
  90. data/spec/{rrj/rabbit/publish/base_publisher_spec.rb → ruby_rabbitmq_janus/rabbit/publisher/base_spec.rb} +3 -3
  91. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/exclusive_spec.rb +0 -0
  92. data/spec/{rrj/rabbit/publish → ruby_rabbitmq_janus/rabbit/publisher}/non_exclusive_spec.rb +0 -0
  93. data/spec/{rrj/tools/gem/rrj_cluster_spec.rb → ruby_rabbitmq_janus/tools/cluster_spec.rb} +1 -21
  94. data/spec/{rrj/tools/gem/rrj_config_spec.rb → ruby_rabbitmq_janus/tools/config_spec.rb} +26 -14
  95. data/spec/{rrj/tools/gem/rrj_log_spec.rb → ruby_rabbitmq_janus/tools/log_spec.rb} +10 -10
  96. data/spec/{rrj/tools/replace/replace_admin_spec.rb → ruby_rabbitmq_janus/tools/replaces/admin_spec.rb} +15 -15
  97. data/spec/{rrj/tools/replace/replace_handle_spec.rb → ruby_rabbitmq_janus/tools/replaces/handle_spec.rb} +14 -14
  98. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools/replaces}/replace_spec.rb +16 -17
  99. data/spec/{rrj/tools/replace/replace_session_spec.rb → ruby_rabbitmq_janus/tools/replaces/session_spec.rb} +14 -14
  100. data/spec/{rrj/tools/replace → ruby_rabbitmq_janus/tools}/type_spec.rb +19 -19
  101. data/spec/spec_helper.rb +1 -1
  102. data/spec/support/examples_request.rb +1 -1
  103. data/spec/support/type.rb +3 -3
  104. metadata +83 -59
  105. data/lib/rrj/errors/rabbit/publish/admin.rb +0 -30
  106. data/lib/rrj/errors/rabbit/publish/base_publisher.rb +0 -23
  107. data/lib/rrj/errors/rabbit/publish/exclusive.rb +0 -31
  108. data/lib/rrj/errors/rabbit/publish/listener.rb +0 -30
  109. data/lib/rrj/errors/rabbit/publish/non_exclusive.rb +0 -31
  110. data/lib/rrj/errors/rabbit/publish/publisher.rb +0 -38
  111. data/lib/rrj/rabbit/publish/base_publisher.rb +0 -50
  112. data/spec/rrj/rabbit/publish/admin_spec.rb +0 -12
  113. data/spec/rrj/rabbit/publish/listener_spec.rb +0 -15
  114. data/spec/rrj/rabbit/publish/publisher_spec.rb +0 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ebf80d553c48520561ad6e0e39f693287092fa5d0835ece9b5da24958a7a274f
4
- data.tar.gz: 0eddd53b9934e02b9a74d98f46f60a5c33221fce8eadb6d43ec1bab5a466e7cd
3
+ metadata.gz: 366cfe85ecbc8c6a35fe4a6d0f5bd15a4e8f67638b06da3d864eb7fb53a84f96
4
+ data.tar.gz: 8828c05189b25e67f09e8e6ed1a9e50d8580aad2b6e417e1d03838dd0054c7eb
5
5
  SHA512:
6
- metadata.gz: c0b04c31f793515e5d2473c8cb53e2fde92d8dac3f77cbdb2ed6b28de9aa49dbe7a44442c4cf55b8a7fce4834858c4819efa59892466fc0edc8c87cfe62eb2a1
7
- data.tar.gz: ce6d9ad8ab1992e06083a77159ba695626777b0194cde1b6e5624be9da3fad2ccfafcb290e9362f644e0bef630e29d16c351f5f4c4f3838bdbc74c700dbffd6a
6
+ metadata.gz: 8149c8eda2ccfc9130e5324ba36a36550d4ff3d30249cac6cededcdf6832731805ca3e4eb503db4cd4a3a2daa14624fc0a0c80668f9c02174478bec7fd3b8c49
7
+ data.tar.gz: 6e13792f23ce4354d3109da8316e6740a158eddf91ba50ce30f018d3bbdea11526c6608f398def518f2a415cd7e733aba7e0a7e662f828a6bf1664304af25d06
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Ruby RabbitMQ Janus | [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus) [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus) [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus)
1
+ # Ruby RabbitMQ Janus | [![Build Status](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus.svg?branch=master)](https://travis-ci.org/dazzl-tv/ruby-rabbitmq-janus) [![Gem Version](https://badge.fury.io/rb/ruby_rabbitmq_janus.svg)](https://badge.fury.io/rb/ruby_rabbitmq_janus) [![inline docs](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus.svg)](http://inch-ci.org/github/dazzl-tv/ruby-rabbitmq-janus) [![Known Vulnerabilities](https://dev.snyk.io/test/github/dev-crea/dazzl-tv/ruby-rabbitmq-janus/badge.svg)](https://dev.snyk.io/test/github/dev-crea/dazzl-tv/ruby-rabbitmq-janus)
2
2
 
3
3
  Ruby Gem for Janus WebRTC Gateway integration using RabbitMQ message queue
4
4
 
@@ -0,0 +1,67 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # Start a threads for each instance to Janus with
4
+ # RubyRabbitMQJanus gem.
5
+ #
6
+ # Use this binaries for start a standalone process RRJ for listen
7
+ # a queue in RabbitMQ and enable (or disable) JanusInstance model in database.
8
+ #
9
+ # @author VAILLANT Jeremy <jeremy@dazzl.tv>
10
+ #
11
+ # Use `Log` variable in ActionEvents class
12
+ # for writing in another logger instead rails logs.
13
+
14
+ ENVIRONMENT = ENV['RAILS_ENV']
15
+ ORM = ENV['ORM']
16
+ LISTENER_PATH = ENV['LISTENER_PATH']
17
+ PROGRAM = ENV['PROGRAM_NAME']
18
+
19
+ begin
20
+ require 'config'
21
+
22
+ if defined?(Config)
23
+ config_conf = [
24
+ File.join(Dir.pwd, 'config', 'settings.yml'),
25
+ File.join(Dir.pwd, 'config', 'settings', "#{ENVIRONMENT}.yml")
26
+ ]
27
+ Config.load_and_set_settings(config_conf)
28
+ end
29
+ rescue LoadError => exception
30
+ p 'Don\'t use gem config'
31
+ p exception
32
+ end
33
+
34
+ # Select ORM between Mongoid and ActiveRecord
35
+ require ORM
36
+ Mongoid.load!(File.join(Dir.pwd, 'config', 'mongoid.yml'), ENVIRONMENT) \
37
+ if defined?(Mongoid)
38
+ require 'ruby_rabbitmq_janus'
39
+
40
+ ::Log = RubyRabbitmqJanus::Tools::Log.instance
41
+
42
+ Log.info "RRJ Version : #{RubyRabbitmqJanus::VERSION}"
43
+ Log.info RubyRabbitmqJanus::BANNER
44
+
45
+ require File.join(File.dirname(__FILE__), '..', 'lib', 'rrj', 'binary')
46
+
47
+ begin
48
+ bin = RubyRabbitmqJanus::Binary.new
49
+ Log.info \
50
+ 'Prepare to listen events in queue : ' + \
51
+ RubyRabbitmqJanus::Tools::Config.instance.queue_janus_instance
52
+ rabbit = RubyRabbitmqJanus::Rabbit::Connect.new
53
+ rabbit.start
54
+ listener = RubyRabbitmqJanus::Rabbit::Listener::JanusInstance.new(rabbit)
55
+ Log.info 'Loop events provided by Janus queues'
56
+ loop do
57
+ listener.listen_events do |event, response|
58
+ Log.debug "Event : #{event}"
59
+ Log.debug "Response : #{response.to_hash}"
60
+ bin.update_instance(response.to_hash)
61
+ end
62
+ end
63
+ rescue => exception
64
+ Log.fatal '!! Fail to start RRJ threads !!'
65
+ Log.fatal exception
66
+ exit 1
67
+ end
data/config/default.md CHANGED
@@ -21,6 +21,7 @@ queues:
21
21
  admin:
22
22
  from: from-janus-admin
23
23
  to: to-janus-admin
24
+ instance: janus-instance-thread
24
25
 
25
26
  janus:
26
27
  session:
@@ -33,6 +34,8 @@ gem:
33
34
  enabled: true
34
35
  log:
35
36
  level: info
37
+ listener:
38
+ path: 'app/ruby_rabbitmq_janus'
36
39
  ```
37
40
 
38
41
  ## Customize
data/config/default.yml CHANGED
@@ -27,6 +27,8 @@ queues:
27
27
  from: from-janus-admin
28
28
  # Queue sending a message for admin API janus
29
29
  to: to-janus-admin
30
+ # Name to queue for managing instances
31
+ instance: janus-instance-thread
30
32
 
31
33
  # Janus plugin used
32
34
  janus:
@@ -54,3 +56,7 @@ gem:
54
56
  # Define level to log
55
57
  # UNKNOW, FATAL, ERROR, WARN, INFO, DEBUG
56
58
  level: debug
59
+ # Options for listener thread
60
+ listener:
61
+ # Represent path to action_events class in project who use this gem
62
+ path: 'app/ruby_rabbitmq_janus'
data/lib/rrj/binary.rb ADDED
@@ -0,0 +1,56 @@
1
+ # frozen_string_literal: true
2
+
3
+ action_event_path = "#{Dir.pwd}/#{LISTENER_PATH}"
4
+ Log.debug "Load action events to path : #{action_event_path}"
5
+ require action_event_path
6
+ require 'rrj/tools/gem/config'
7
+ require 'rrj/models/concerns/janus_instance_callbacks'
8
+ require 'rrj/models/concerns/janus_instance_methods'
9
+ require 'rrj/models/concerns/janus_instance_validations'
10
+ require "rrj/models/#{defined?(Mongoid) ? 'mongoid' : 'active_record'}"
11
+
12
+ module RubyRabbitmqJanus
13
+ # # RubyRabbitmqJanus Bynary
14
+ #
15
+ # Initialize tools for a standalone executable
16
+ # This class start all tool mandatory for
17
+ # survey new message about JanusInstance change state.
18
+ #
19
+ # When status enable change update document in database
20
+ # if enable become true a new session with janus is created
21
+ class Binary
22
+ def initialize
23
+ RubyRabbitmqJanus::Tools::Config.instance
24
+
25
+ start_instances
26
+ end
27
+
28
+ def update_instance(data)
29
+ enable = data['enable']
30
+ @ji = RubyRabbitmqJanus::Models::JanusInstance.find(data['id'])
31
+
32
+ ::Log.info 'Update Janus Instance ...'
33
+ enable ? start_instance : stop_instance
34
+ end
35
+
36
+ private
37
+
38
+ def start_instances
39
+ ::Log.info 'Search Janus Instance'
40
+ instances = RubyRabbitmqJanus::Models::JanusInstance.enabled
41
+
42
+ ::Log.info "Find [#{instances.count}] instance(s) enable"
43
+ instances.each(&:create_keepalive) unless instances.empty?
44
+ end
45
+
46
+ def start_instance
47
+ ::Log.info "... create a session to Janus Instance with id : #{@ji.id}"
48
+ @ji.create_keepalive
49
+ end
50
+
51
+ def stop_instance
52
+ ::Log.info "... stop a session to Janus Instance with ID : #{@ji.id}"
53
+ @ji.stop_keepalive
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,21 @@
1
+ # frozen-string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ class Event < BaseRabbit
7
+ def initialize(message, level = :fatal)
8
+ super("[Connect] #{message}", level)
9
+ end
10
+ end
11
+
12
+ module BaseEvent
13
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Event
14
+ def initialize
15
+ super 'Error in intializer BaseEvent'
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,29 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Listener
7
+ class BaseError < BaseRabbit
8
+ def initialize(message, level = :fatal)
9
+ super("[Listener] #{message}", level)
10
+ end
11
+ end
12
+
13
+ module Base
14
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
15
+ def initialize
16
+ super 'Error in initialize'
17
+ end
18
+ end
19
+
20
+ class ListenEvents < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
21
+ def initialize
22
+ super "Error when listen events to queue 'janus-instance-thread'"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Listener
7
+ module From
8
+ class ListenEvents < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
9
+ def initialize(error)
10
+ super "Error for listen events in RabbitMQ public queue, #{error}"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Listener
7
+ module FromAdmin
8
+ class ListenEvents < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
9
+ def initialize(error)
10
+ super "Error for listen events in RabbitMQ public queue, #{error}"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Listener
7
+ module JanusInstance
8
+ class ListenEvents < RubyRabbitmqJanus::Errors::Rabbit::Listener::BaseError
9
+ def initialize(error)
10
+ super "Error for listen events in RabbitMQ public queue, #{error}"
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Publisher
7
+ # Define a super class for all errors in Rabbit::Publisher::PublisherAdmin
8
+ class BasePublisherAdmin < BaseErrorPublisher
9
+ def initialize(message, level = :fatal)
10
+ super "[Admin] #{message}", level
11
+ end
12
+ end
13
+
14
+ module Admin
15
+ # Error for Rabbit::Publisher::PublisherAdmin#initialize
16
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublisherAdmin
17
+ def initialize
18
+ super 'Error in initializer'
19
+ end
20
+ end
21
+
22
+ # Error for Rabbit::Publisher::PublisherAdmin#publish
23
+ class Publish < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublisherAdmin
24
+ def initialize
25
+ super 'Error for publish message'
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Publisher
7
+ # Define a super class for all errors in Rabbit::BaseEvent
8
+ class BaseErrorPublisher < BaseRabbit
9
+ def initialize(message, level = :fatal)
10
+ super "[Publisher] #{message}", level
11
+ end
12
+ end
13
+
14
+ module Base
15
+ # Error for Rabbit::BaseEvent#initialize
16
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BaseErrorPublisher
17
+ def initialize
18
+ super 'Error in initializer'
19
+ end
20
+ end
21
+
22
+ class Publish < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BaseErrorPublisher
23
+ def initialize
24
+ super 'Error for publishing message'
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Publisher
7
+ # Define a super class for all errors in
8
+ # Rabbit::Publisher::Exclusive
9
+ class BasePublishExclusive < BaseErrorPublisher
10
+ def initialize(message, level = :fatal)
11
+ super "[Exclusive] #{message}", level
12
+ end
13
+ end
14
+
15
+ module Exclusive
16
+ # Error for Rabbit::Publisher::Exclusive#initialize
17
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishExclusive
18
+ def initialize
19
+ super 'Error in initializer'
20
+ end
21
+ end
22
+
23
+ # Error for Rabbit::Publisher::Exclusive#publish
24
+ class Publish < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishExclusive
25
+ def initialize
26
+ super 'Error for publish message'
27
+ end
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 Rabbit
6
+ module Publisher
7
+ module JanusInstance
8
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishExclusive
9
+ def initialize
10
+ super 'Error in initializer'
11
+ end
12
+ end
13
+
14
+ class Publish < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublisherAdmin
15
+ def initialize
16
+ super 'Error publish message in queue'
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Publisher
7
+ module Keepalive
8
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishExclusive
9
+ def initialize
10
+ super 'Error in initializer'
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ module RubyRabbitmqJanus
4
+ module Errors
5
+ module Rabbit
6
+ module Publisher
7
+ # Define a super class for all errors in
8
+ # Rabbit::Publisher::NonExclusive
9
+ class BasePublishNonExclusive < BaseErrorPublisher
10
+ def initialize(message, level = :fatal)
11
+ super "[Non Exclusive] #{message}", level
12
+ end
13
+ end
14
+
15
+ module PublishNonExclusive
16
+ # Error for Rabbit::Publisher::NonExclusive#initialize
17
+ class Initialize < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishNonExclusive
18
+ def initialize
19
+ super 'Error in initializer'
20
+ end
21
+ end
22
+
23
+ # Error for Rabbit::Publisher::NonExclusive#publish
24
+ class Publish < RubyRabbitmqJanus::Errors::Rabbit::Publisher::BasePublishNonExclusive
25
+ def initialize
26
+ super 'Error for publish message'
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end