ruby_rabbitmq_janus 2.2.0.pre.177 → 2.2.0.pre.179
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/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 +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc2b31862c0708c674e7a21f98ae77061baaa722
|
4
|
+
data.tar.gz: 2b771ef4c51d25bde097b7e4ced7e2b94f99932d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a24227cb75c670aa8ec50c8954787b05ad66adf2706533f305556fb1ffa6f63c34e9f77f2e894bfc2d2f440aba7619f9082b519ffae4d73e433364a4556636ae
|
7
|
+
data.tar.gz: da9961ca948a7d237d7266911ed4e2234b8d926d4fa264aa411caa0363875a7ecd0962ce59a0f4e79243ed84d7f3bd1a4f4b75876516e5a064573da6d492a8be
|
@@ -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
|
@@ -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.0.pre.
|
4
|
+
version: 2.2.0.pre.179
|
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
|