ruby_rabbitmq_janus 2.2.0 → 2.2.1.pre.180
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rrj/errors/janus/processus/keepalive/initializer.rb +6 -0
- data/lib/rrj/errors/rabbit/publish/publisher.rb +8 -0
- data/lib/rrj/info.rb +1 -1
- data/lib/rrj/janus/processus/keepalive/keepalive_initializer.rb +1 -1
- data/lib/rrj/janus/processus/keepalive/keepalive_thread.rb +8 -3
- data/lib/rrj/rabbit/publish/publisher.rb +12 -5
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d1231f2f5d34994a2952bbcf7d698d6bb560354
|
4
|
+
data.tar.gz: 91061eb621ed490eff870d9f9dc38fcb181e0490
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a605a1bb670e7a0a87d38e8179fd38d2cd090b8cb6581a5f7af2ec47dba6d021b320882a7b00663dd3d8603a797ade50ff424e3e3a6dce033165ea433988cad9
|
7
|
+
data.tar.gz: 74011ff5c13e91f8d108a7a34bfefe51e328cac6904a2a9539a3c79f8d12e2f248756964b0db7f9fca50be3e0351eba0789ef62e8284f3a7d3ed4c933dd27e8e
|
@@ -18,6 +18,12 @@ module RubyRabbitmqJanus
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
+
class ID2ref < RubyRabbitmqJanus::Errors::Janus::BaseKeepaliveInitializer
|
22
|
+
def initialize(thread_id)
|
23
|
+
super "No thread with ID : #{thread_id}"
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
21
27
|
class Session < RubyRabbitmqJanus::Errors::Janus::BaseKeepaliveInitializer
|
22
28
|
def initialize
|
23
29
|
super 'Error return session number'
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# :reek:IrresponsibleModule
|
4
|
+
#
|
3
5
|
module RubyRabbitmqJanus
|
4
6
|
module Errors
|
5
7
|
module Rabbit
|
@@ -24,6 +26,12 @@ module RubyRabbitmqJanus
|
|
24
26
|
super 'Error for publish message'
|
25
27
|
end
|
26
28
|
end
|
29
|
+
|
30
|
+
class Testcorrelation < RubyRabbitmqJanus::Errors::Rabbit::BasePublish
|
31
|
+
def initialize(message, propertie)
|
32
|
+
super "Response correlation ID mismatch (#{message} != #{propertie})", :fatal
|
33
|
+
end
|
34
|
+
end
|
27
35
|
end
|
28
36
|
end
|
29
37
|
end
|
data/lib/rrj/info.rb
CHANGED
@@ -26,7 +26,7 @@ module RubyRabbitmqJanus
|
|
26
26
|
def self.thread(thread)
|
27
27
|
ObjectSpace._id2ref(thread)
|
28
28
|
rescue RangeError
|
29
|
-
|
29
|
+
raise Errors::Janus::KeepaliveInitializer::ID2Ref, thread
|
30
30
|
end
|
31
31
|
|
32
32
|
# Give a session Integer his gem is instantiate.
|
@@ -34,9 +34,9 @@ module RubyRabbitmqJanus
|
|
34
34
|
# Restart session
|
35
35
|
def restart_session
|
36
36
|
Tools::Log.instance.warn 'Restart session ...'
|
37
|
-
|
38
|
-
|
39
|
-
|
37
|
+
janus = find_model
|
38
|
+
send_messages_restart
|
39
|
+
janus.set(session: @session)
|
40
40
|
rescue
|
41
41
|
raise Errors::Janus::KeepaliveThread::RestartSession
|
42
42
|
end
|
@@ -76,6 +76,11 @@ module RubyRabbitmqJanus
|
|
76
76
|
|
77
77
|
attr_reader :instance
|
78
78
|
|
79
|
+
def send_messages_restart
|
80
|
+
@session = response_session
|
81
|
+
response_keepalive
|
82
|
+
end
|
83
|
+
|
79
84
|
def prepare_kill_thread
|
80
85
|
@session = @message = nil
|
81
86
|
KeepaliveThread.instance_method(:kill).bind(self).call
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Style/GuardClause
|
4
|
+
|
3
5
|
module RubyRabbitmqJanus
|
4
6
|
module Rabbit
|
5
7
|
module Publisher
|
@@ -37,12 +39,8 @@ module RubyRabbitmqJanus
|
|
37
39
|
|
38
40
|
def subscribe_to_queue
|
39
41
|
reply.subscribe do |_delivery_info, propertie, payload|
|
40
|
-
|
41
|
-
if m_correlation.eql?(propertie_correlation)
|
42
|
+
test_correlation(m_correlation, p_correlation(propertie)) do
|
42
43
|
synchronize(payload)
|
43
|
-
else
|
44
|
-
Tools::Log.instance.error 'Response correlation ID mismatch (' \
|
45
|
-
"#{m_correlation}!=#{propertie_correlation})"
|
46
44
|
end
|
47
45
|
end
|
48
46
|
end
|
@@ -55,6 +53,14 @@ module RubyRabbitmqJanus
|
|
55
53
|
propertie.correlation_id
|
56
54
|
end
|
57
55
|
|
56
|
+
def test_correlation(m_cor, p_cor)
|
57
|
+
if m_cor.eql?(p_cor)
|
58
|
+
yield
|
59
|
+
else
|
60
|
+
raise Errors::Rabbit::Publish::TestCorrelation, m_cor, p_cor
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
58
64
|
def synchronize(payload)
|
59
65
|
lock.synchronize do
|
60
66
|
responses.push(JSON.parse(payload))
|
@@ -67,6 +73,7 @@ module RubyRabbitmqJanus
|
|
67
73
|
end
|
68
74
|
end
|
69
75
|
end
|
76
|
+
# rubocop:enable Style/GuardClause
|
70
77
|
|
71
78
|
require 'rrj/rabbit/publish/admin'
|
72
79
|
require 'rrj/rabbit/publish/exclusive'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby_rabbitmq_janus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.2.
|
4
|
+
version: 2.2.1.pre.180
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- VAILLANT Jeremy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-09-
|
11
|
+
date: 2017-09-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -612,9 +612,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
612
612
|
version: '0'
|
613
613
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
614
614
|
requirements:
|
615
|
-
- - "
|
615
|
+
- - ">"
|
616
616
|
- !ruby/object:Gem::Version
|
617
|
-
version:
|
617
|
+
version: 1.3.1
|
618
618
|
requirements: []
|
619
619
|
rubyforge_project:
|
620
620
|
rubygems_version: 2.6.13
|