ruby_rabbitmq_janus 3.0.0.pre.352 → 3.0.0.pre.382
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Rakefile +1 -2
- data/lib/generators/ruby_rabbitmq_janus/migration_generator.rb +2 -0
- data/lib/rrj/errors/error.rb +1 -1
- data/lib/rrj/janus/responses/admin.rb +13 -9
- data/lib/rrj/janus/responses/error.rb +0 -2
- data/lib/rrj/janus/responses/rspec.rb +2 -0
- data/lib/rrj/janus/responses/standard.rb +1 -0
- data/lib/rrj/janus/transactions/handle.rb +2 -0
- data/lib/rrj/janus/transactions/rspec.rb +2 -0
- data/lib/rrj/janus/transactions/session.rb +1 -0
- data/lib/rrj/models/active_record.rb +3 -0
- data/lib/rrj/models/concerns/instances.rb +11 -6
- data/lib/rrj/process/concurrency.rb +9 -3
- data/lib/rrj/process/event.rb +8 -26
- data/lib/rrj/process/event_admin.rb +8 -26
- data/lib/rrj/process/thread_runner_concern.rb +56 -0
- data/lib/rrj/rabbit/base_event.rb +2 -2
- data/lib/rrj/rabbit/connect.rb +12 -4
- data/lib/rrj/rabbit/listener/base.rb +17 -1
- data/lib/rrj/rabbit/listener/from.rb +2 -15
- data/lib/rrj/rabbit/listener/from_admin.rb +2 -15
- data/lib/rrj/rabbit/publisher/non_exclusive.rb +3 -0
- data/lib/rrj/rails.rb +9 -5
- data/lib/rrj/rspec.rb +5 -0
- data/lib/rrj/task.rb +2 -0
- data/lib/rrj/tools/gem/config/gem.rb +1 -1
- data/lib/rrj/tools/gem/logger.rb +1 -2
- data/lib/rrj/tools/gem/requests.rb +2 -2
- data/spec/config/database.rb +1 -0
- data/spec/factories/janus_instance.rb +2 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/errors_spec.rb +175 -0
- data/spec/ruby_rabbitmq_janus/janus/responses/response_spec.rb +1 -1
- data/spec/ruby_rabbitmq_janus/models/{janus_instance_definition_spec.rb → janus_instance_field_spec.rb} +0 -0
- data/spec/ruby_rabbitmq_janus/models/janus_instance_instance_spec.rb +47 -0
- data/spec/ruby_rabbitmq_janus/models/{janus_instance_spec.rb → janus_instance_validation_spec.rb} +10 -2
- data/spec/ruby_rabbitmq_janus/process/concurrencies/concurrency_spec.rb +1 -5
- data/spec/ruby_rabbitmq_janus/process/concurrencies/event_admin_spec.rb +3 -2
- data/spec/ruby_rabbitmq_janus/process/concurrencies/event_spec.rb +3 -2
- data/spec/ruby_rabbitmq_janus/rabbit/listener/from_spec.rb +1 -0
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/admin_spec.rb +1 -0
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/exclusive_spec.rb +4 -3
- data/spec/ruby_rabbitmq_janus/rabbit/publisher/non_exclusive_spec.rb +4 -4
- data/spec/ruby_rabbitmq_janus/tools/logger_spec.rb +34 -0
- data/spec/ruby_rabbitmq_janus/tools/replaces/admin_spec.rb +2 -2
- data/spec/ruby_rabbitmq_janus/tools/replaces/handle_spec.rb +1 -1
- data/spec/ruby_rabbitmq_janus/tools/type_spec.rb +1 -1
- data/spec/spec_helper.rb +27 -3
- data/spec/support/examples_model.rb +45 -0
- data/spec/support/examples_thread.rb +18 -12
- data/tmp/coverage/assets/0.10.2/application.css +799 -0
- data/tmp/coverage/assets/0.10.2/application.js +1707 -0
- data/tmp/coverage/assets/0.10.2/colorbox/border.png +0 -0
- data/tmp/coverage/assets/0.10.2/colorbox/controls.png +0 -0
- data/tmp/coverage/assets/0.10.2/colorbox/loading.gif +0 -0
- data/tmp/coverage/assets/0.10.2/colorbox/loading_background.png +0 -0
- data/tmp/coverage/assets/0.10.2/favicon_green.png +0 -0
- data/tmp/coverage/assets/0.10.2/favicon_red.png +0 -0
- data/tmp/coverage/assets/0.10.2/favicon_yellow.png +0 -0
- data/tmp/coverage/assets/0.10.2/loading.gif +0 -0
- data/tmp/coverage/assets/0.10.2/magnify.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_222222_256x240.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_454545_256x240.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_888888_256x240.png +0 -0
- data/tmp/coverage/assets/0.10.2/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
- data/tmp/coverage/index.html +21249 -0
- metadata +74 -10
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5e2788aaa9bf06b85b431dfa06ac04bb1315bbf2a0eebdd73b91367e535b4cea
|
|
4
|
+
data.tar.gz: deccabc4e76a96d6db5335625cef5086c7aabcad8930590cff866d6c7abbf9e7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cab7ca08efd87ef15d24c71612d96d6b8deb460619af6ea79ff6f09cc025dbf1c2683cdd145bcfba781df2202b94ff9a3a4a7fcd99e9247016a2790dc313ba9a
|
|
7
|
+
data.tar.gz: 32c1868c00b6c01a7f76b870ecc4f064c2c959f32bf54025fd94fca8cf93dc61cdf87847a1a978d2cf15b6470a2a27d58bb324014cdd6181cf3f84df3dfcfd19
|
data/Rakefile
CHANGED
|
@@ -4,8 +4,7 @@ require 'bundler/gem_tasks'
|
|
|
4
4
|
require 'rspec/core/rake_task'
|
|
5
5
|
|
|
6
6
|
# Exclude all spec with type :thread
|
|
7
|
-
RSpec::Core::RakeTask.new(:spec)
|
|
8
|
-
end
|
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
|
9
8
|
|
|
10
9
|
# Exclude all spec with type :thread
|
|
11
10
|
RSpec::Core::RakeTask.new(:classic) do |t|
|
|
@@ -16,11 +16,13 @@ module RubyRabbitmqJanus
|
|
|
16
16
|
|
|
17
17
|
source_root File.expand_path('templates', __dir__)
|
|
18
18
|
|
|
19
|
+
# Prepare files for migration.
|
|
19
20
|
def install
|
|
20
21
|
migration_template 'migration.rb',
|
|
21
22
|
'db/migrate/create_ruby_rabbitmq_janus_tables.rb'
|
|
22
23
|
end
|
|
23
24
|
|
|
25
|
+
# Determines the version number of the next migration.
|
|
24
26
|
def self.next_migration_number(dirname)
|
|
25
27
|
ActiveRecord::Generators::Base.next_migration_number(dirname)
|
|
26
28
|
end
|
data/lib/rrj/errors/error.rb
CHANGED
|
@@ -20,7 +20,7 @@ module RubyRabbitmqJanus
|
|
|
20
20
|
|
|
21
21
|
def write_error(message, level = :unknown)
|
|
22
22
|
if defined?(::Log)
|
|
23
|
-
::Log.send(level.
|
|
23
|
+
::Log.send(level.instance_of?(Symbol) ? level : int_to_level(level),
|
|
24
24
|
message)
|
|
25
25
|
else
|
|
26
26
|
p "#{level}, #{message}"
|
|
@@ -7,55 +7,59 @@ module RubyRabbitmqJanus
|
|
|
7
7
|
#
|
|
8
8
|
# @see Example request response https://janus.conf.meetecho.com/docs/admin.html
|
|
9
9
|
class Admin < Standard
|
|
10
|
-
# List of sessions running in Janus Instance.
|
|
11
|
-
#
|
|
12
|
-
# @return [Array] List of sessions
|
|
10
|
+
# @return [Array] List of sessions running in Janus Instance.
|
|
13
11
|
def sessions
|
|
14
12
|
read_data(__method__.to_s)
|
|
15
13
|
end
|
|
16
14
|
|
|
17
|
-
# List of handles running
|
|
18
|
-
#
|
|
19
|
-
# @return [Array] List of handles
|
|
15
|
+
# @return [Array] List of handles running
|
|
16
|
+
# in one session in Janus Instance.
|
|
20
17
|
def handles
|
|
21
18
|
read_data(__method__.to_s)
|
|
22
19
|
end
|
|
23
20
|
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
# @return [Hash] Information to session/handle
|
|
21
|
+
# @return [Hash] Information to session/handle in Janus Instance.
|
|
27
22
|
def info
|
|
28
23
|
read_data(__method__.to_s)
|
|
29
24
|
end
|
|
30
25
|
|
|
26
|
+
# @return [Boolean] Information status to debug mode for libnice.
|
|
31
27
|
def libnice_debug
|
|
32
28
|
read_data(__method__.to_s)
|
|
33
29
|
end
|
|
34
30
|
|
|
31
|
+
# @return [Boolean] Information status to debug mode
|
|
32
|
+
# in Janus Intance on the fly.
|
|
35
33
|
def locking_debug
|
|
36
34
|
read_data(__method__.to_s)
|
|
37
35
|
end
|
|
38
36
|
|
|
37
|
+
# @return [Boolean] Information about color in log messages.
|
|
39
38
|
def log_colors
|
|
40
39
|
read_data(__method__.to_s)
|
|
41
40
|
end
|
|
42
41
|
|
|
42
|
+
# @return [Integer] Level to debug mode to Janus Instance.
|
|
43
43
|
def level
|
|
44
44
|
read_data(__method__.to_s)
|
|
45
45
|
end
|
|
46
46
|
|
|
47
|
+
# @return [Boolean] Status to timestampping for log messages.
|
|
47
48
|
def log_timestamps
|
|
48
49
|
read_data(__method__.to_s)
|
|
49
50
|
end
|
|
50
51
|
|
|
52
|
+
# @return [Integer] Level to max nack queue configured.
|
|
51
53
|
def max_nack_queue
|
|
52
54
|
read_data(__method__.to_s)
|
|
53
55
|
end
|
|
54
56
|
|
|
57
|
+
# @return [Integer] No-media timer property.
|
|
55
58
|
def no_media_timer
|
|
56
59
|
read_data(__method__.to_s)
|
|
57
60
|
end
|
|
58
61
|
|
|
62
|
+
# @return [Integer] Timeout for session.
|
|
59
63
|
def timeout
|
|
60
64
|
read_data(__method__.to_s)
|
|
61
65
|
end
|
|
@@ -143,11 +143,9 @@ module RubyRabbitmqJanus
|
|
|
143
143
|
|
|
144
144
|
def respond_to_missing?(name, include_private); end
|
|
145
145
|
|
|
146
|
-
# rubocop:disable Style/MethodMissingSuper
|
|
147
146
|
def method_missing(_method, request)
|
|
148
147
|
default_error(request)
|
|
149
148
|
end
|
|
150
|
-
# rubocop:enable Style/MethodMissingSuper
|
|
151
149
|
|
|
152
150
|
def default_error(request)
|
|
153
151
|
raise RubyRabbitmqJanus::Errors::Janus::Responses::Nok, request
|
|
@@ -7,6 +7,8 @@ module RubyRabbitmqJanus
|
|
|
7
7
|
module Responses
|
|
8
8
|
# Response for RSpec initializer
|
|
9
9
|
class RSpec
|
|
10
|
+
# Constructor to RSpec response.
|
|
11
|
+
# Create a fake response for testing library.
|
|
10
12
|
def initialize(type)
|
|
11
13
|
path = RubyRabbitmqJanus::Tools::Config.instance.rspec_response
|
|
12
14
|
@json = File.join(Dir.pwd,
|
|
@@ -70,11 +70,13 @@ module RubyRabbitmqJanus
|
|
|
70
70
|
@handle = send_a_message_exclusive { msg }
|
|
71
71
|
end
|
|
72
72
|
|
|
73
|
+
# rubocop:disable Style/ExplicitBlockArgument
|
|
73
74
|
def send_a_message_exclusive
|
|
74
75
|
Janus::Responses::Standard.new(read_response_exclusive do
|
|
75
76
|
yield
|
|
76
77
|
end).sender
|
|
77
78
|
end
|
|
79
|
+
# rubocop:enable Style/ExplicitBlockArgument
|
|
78
80
|
|
|
79
81
|
def read_response_exclusive
|
|
80
82
|
chan = rabbit.channel
|
|
@@ -31,9 +31,12 @@ module RubyRabbitmqJanus
|
|
|
31
31
|
# @param attributes [Array] List to attribute to delete in document
|
|
32
32
|
#
|
|
33
33
|
# @return [Hash] Current model
|
|
34
|
+
#
|
|
35
|
+
# rubocop:disable Style/HashTransformValues
|
|
34
36
|
def unset(attributes)
|
|
35
37
|
Hash[attributes.map { |key, _value| [key, nil] }]
|
|
36
38
|
end
|
|
39
|
+
# rubocop:enable Style/HashTransformValues
|
|
37
40
|
end
|
|
38
41
|
end
|
|
39
42
|
end
|
|
@@ -12,32 +12,37 @@ module RubyRabbitmqJanus
|
|
|
12
12
|
module ClassMethods
|
|
13
13
|
# Disable an instance
|
|
14
14
|
def disable(session_id)
|
|
15
|
-
|
|
15
|
+
find_by_session(session_id).set(enable: false)
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Enable an instance
|
|
19
|
+
def enable(session_id)
|
|
20
|
+
find_by_session(session_id).set(enable: true)
|
|
16
21
|
end
|
|
17
22
|
|
|
18
23
|
# Clean all instance disabled
|
|
19
24
|
def destroys
|
|
20
|
-
|
|
25
|
+
where(enable: false).delete_all
|
|
21
26
|
end
|
|
22
27
|
|
|
23
28
|
# Search a record by instance number
|
|
24
29
|
def find_by_instance(instance_search)
|
|
25
|
-
|
|
30
|
+
find_by(instance: instance_search)
|
|
26
31
|
end
|
|
27
32
|
|
|
28
33
|
# Search a record by session number
|
|
29
34
|
def find_by_session(session_search)
|
|
30
|
-
|
|
35
|
+
find_by(session_id: session_search)
|
|
31
36
|
end
|
|
32
37
|
|
|
33
38
|
# Get all instance active
|
|
34
39
|
def enabled
|
|
35
|
-
|
|
40
|
+
where(enable: true)
|
|
36
41
|
end
|
|
37
42
|
|
|
38
43
|
# Get all instance not active
|
|
39
44
|
def disabled
|
|
40
|
-
|
|
45
|
+
where(enable: false)
|
|
41
46
|
end
|
|
42
47
|
end
|
|
43
48
|
end
|
|
@@ -22,18 +22,24 @@ module RubyRabbitmqJanus
|
|
|
22
22
|
|
|
23
23
|
private
|
|
24
24
|
|
|
25
|
+
attr_reader :lock, :condition, :rabbit
|
|
26
|
+
|
|
25
27
|
def initialize_thread
|
|
26
28
|
@rabbit.transaction_long { transaction_running }
|
|
27
29
|
rescue Interrupt
|
|
28
|
-
::Log.
|
|
30
|
+
::Log.warn "This process has been interupted #{class_name}"
|
|
31
|
+
::Log.warn \
|
|
32
|
+
"Close a connection with RabbitMQ instance for #{class_name}"
|
|
29
33
|
@rabbit.close
|
|
30
34
|
end
|
|
31
35
|
|
|
32
36
|
def info_thread
|
|
33
|
-
"Create an thread -- #{
|
|
37
|
+
"Create an thread -- #{class_name}"
|
|
34
38
|
end
|
|
35
39
|
|
|
36
|
-
|
|
40
|
+
def class_name
|
|
41
|
+
self.class.name
|
|
42
|
+
end
|
|
37
43
|
end
|
|
38
44
|
end
|
|
39
45
|
end
|
data/lib/rrj/process/event.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'rrj/process/thread_runner_concern'
|
|
4
|
+
|
|
3
5
|
module RubyRabbitmqJanus
|
|
4
6
|
module Process
|
|
5
7
|
module Concurrencies
|
|
@@ -12,40 +14,20 @@ module RubyRabbitmqJanus
|
|
|
12
14
|
#
|
|
13
15
|
# @see file:/config/default.md For more information to config file used.
|
|
14
16
|
class Event < Concurrency
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def initialize
|
|
18
|
-
super
|
|
19
|
-
@thread = Thread.new { initialize_thread }
|
|
20
|
-
end
|
|
17
|
+
include RubyRabbitmqJanus::Process::Concurrencies::ThreadRunnerConcern
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
# @param [Proc] block Block code for execute action when queue
|
|
25
|
-
# standard 'from-janus' receive a message.This block is sending to
|
|
26
|
-
# publisher created for this thread.
|
|
27
|
-
#
|
|
28
|
-
# @return [Thread] It's a thread who listen queue and execute action
|
|
29
|
-
def run(&block)
|
|
30
|
-
raise RubyRabbitmqJanus::Errors::Process::Event::Run \
|
|
31
|
-
unless block_given?
|
|
19
|
+
private
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
loop do
|
|
36
|
-
@thread.thread_variable_get(NAME_VAR).listen_events(&block)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
21
|
+
def name_publisher
|
|
22
|
+
:pub_classic
|
|
39
23
|
end
|
|
40
24
|
|
|
41
|
-
private
|
|
42
|
-
|
|
43
25
|
def publisher
|
|
44
26
|
Rabbit::Listener::From.new(rabbit)
|
|
45
27
|
end
|
|
46
28
|
|
|
47
|
-
def
|
|
48
|
-
|
|
29
|
+
def raise_nil_block
|
|
30
|
+
raise RubyRabbitmqJanus::Errors::Process::Event::Run
|
|
49
31
|
end
|
|
50
32
|
end
|
|
51
33
|
end
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'rrj/process/thread_runner_concern'
|
|
4
|
+
|
|
3
5
|
module RubyRabbitmqJanus
|
|
4
6
|
module Process
|
|
5
7
|
module Concurrencies
|
|
@@ -12,40 +14,20 @@ module RubyRabbitmqJanus
|
|
|
12
14
|
#
|
|
13
15
|
# @see file:/config/default.md For more information to config file used.
|
|
14
16
|
class EventAdmin < Concurrency
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def initialize
|
|
18
|
-
super
|
|
19
|
-
@thread = Thread.new { initialize_thread }
|
|
20
|
-
end
|
|
17
|
+
include RubyRabbitmqJanus::Process::Concurrencies::ThreadRunnerConcern
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
#
|
|
24
|
-
# @param [Proc] block Block code for execute action when queue
|
|
25
|
-
# standard 'from-janus' receive a message.This block is sending to
|
|
26
|
-
# publisher created for this thread.
|
|
27
|
-
#
|
|
28
|
-
# @return [Thread] It's a thread who listen queue and execute action
|
|
29
|
-
def run(&block)
|
|
30
|
-
raise RubyRabbitmqJanus::Errors::Process::EventAdmin::Run \
|
|
31
|
-
unless block_given?
|
|
19
|
+
private
|
|
32
20
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
loop do
|
|
36
|
-
@thread.thread_variable_get(NAME_VAR).listen_events(&block)
|
|
37
|
-
end
|
|
38
|
-
end
|
|
21
|
+
def name_publisher
|
|
22
|
+
:pub_admin
|
|
39
23
|
end
|
|
40
24
|
|
|
41
|
-
private
|
|
42
|
-
|
|
43
25
|
def publisher
|
|
44
26
|
Rabbit::Listener::FromAdmin.new(rabbit)
|
|
45
27
|
end
|
|
46
28
|
|
|
47
|
-
def
|
|
48
|
-
|
|
29
|
+
def raise_nil_block
|
|
30
|
+
raise RubyRabbitmqJanus::Errors::Process::EventAdmin::Run
|
|
49
31
|
end
|
|
50
32
|
end
|
|
51
33
|
end
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'active_support/concern'
|
|
4
|
+
|
|
5
|
+
module RubyRabbitmqJanus
|
|
6
|
+
module Process
|
|
7
|
+
module Concurrencies
|
|
8
|
+
# Module injected in Concurrencies classes.
|
|
9
|
+
#
|
|
10
|
+
# Manage threads for public/admin queue to rabbitmq.
|
|
11
|
+
#
|
|
12
|
+
# :reek:ModuleInitialize
|
|
13
|
+
module ThreadRunnerConcern
|
|
14
|
+
extend ActiveSupport::Concern
|
|
15
|
+
|
|
16
|
+
included do
|
|
17
|
+
# Initialize an process (event/event_admin) and configure
|
|
18
|
+
# the life cycle to thread.
|
|
19
|
+
def initialize
|
|
20
|
+
super
|
|
21
|
+
@thread = Thread.new { initialize_thread }
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Create a thread for execute a block code in a thread.
|
|
25
|
+
# This code is outside to `RRJ` gem so is very important
|
|
26
|
+
# to be sure this code execution is not fail.
|
|
27
|
+
#
|
|
28
|
+
# @param [Proc] block Block code for execute action when queue
|
|
29
|
+
# standard 'from-janus' receive a message.This block is sending to
|
|
30
|
+
# publisher created for this thread.
|
|
31
|
+
#
|
|
32
|
+
# @return [Thread] It's a thread who listen queue and execute action
|
|
33
|
+
def run(&block)
|
|
34
|
+
raise_nil_block unless block
|
|
35
|
+
|
|
36
|
+
@thread.join
|
|
37
|
+
Thread.new do
|
|
38
|
+
loop do
|
|
39
|
+
@thread.thread_variable_get(name_publisher)
|
|
40
|
+
.listen_events(&block)
|
|
41
|
+
rescue => exception
|
|
42
|
+
::Log.warn exception
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
|
|
47
|
+
private
|
|
48
|
+
|
|
49
|
+
def transaction_running
|
|
50
|
+
@thread.thread_variable_set(name_publisher, publisher)
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
end
|
|
56
|
+
end
|
|
@@ -10,9 +10,9 @@ module RubyRabbitmqJanus
|
|
|
10
10
|
# # Parent class for all publisher
|
|
11
11
|
# This element send and read a message in rabbitmq Queue
|
|
12
12
|
#
|
|
13
|
-
# @!attribute [r]
|
|
13
|
+
# @!attribute [r] responses
|
|
14
14
|
# @return [RubyRabbitmqJanus::Janus::Responses::Response]
|
|
15
|
-
# Given
|
|
15
|
+
# Given an array of Janus response
|
|
16
16
|
#
|
|
17
17
|
# @abstract Publish message in RabbitMQ
|
|
18
18
|
class BaseEvent
|