amq-client 0.7.0.alpha1 → 0.7.0.alpha2
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +35 -13
- data/examples/eventmachine_adapter/authentication/plain_password_with_custom_role_credentials.rb +0 -8
- data/examples/eventmachine_adapter/connection_failure_callback.rb +26 -0
- data/examples/eventmachine_adapter/connection_failure_exception.rb +30 -0
- data/examples/eventmachine_adapter/tls/tls_without_peer_verification.rb +36 -0
- data/examples/tls_certificates/client/cert.pem +18 -0
- data/examples/tls_certificates/client/key.pem +27 -0
- data/examples/tls_certificates/client/keycert.p12 +0 -0
- data/examples/tls_certificates/client/req.pem +15 -0
- data/examples/tls_certificates/server/cert.pem +18 -0
- data/examples/tls_certificates/server/key.pem +27 -0
- data/examples/tls_certificates/server/keycert.p12 +0 -0
- data/examples/tls_certificates/server/req.pem +15 -0
- data/examples/tls_certificates/testca/cacert.cer +0 -0
- data/examples/tls_certificates/testca/cacert.pem +17 -0
- data/examples/tls_certificates/testca/certs/01.pem +18 -0
- data/examples/tls_certificates/testca/certs/02.pem +18 -0
- data/examples/tls_certificates/testca/index.txt +2 -0
- data/examples/tls_certificates/testca/index.txt.attr +1 -0
- data/examples/tls_certificates/testca/index.txt.attr.old +1 -0
- data/examples/tls_certificates/testca/index.txt.old +1 -0
- data/examples/tls_certificates/testca/openssl.cnf +53 -0
- data/examples/tls_certificates/testca/private/cakey.pem +27 -0
- data/examples/tls_certificates/testca/serial +1 -0
- data/examples/tls_certificates/testca/serial.old +1 -0
- data/lib/amq/client/adapters/event_machine.rb +64 -13
- data/lib/amq/client/channel.rb +0 -1
- data/lib/amq/client/exceptions.rb +15 -0
- data/lib/amq/client/version.rb +1 -1
- metadata +27 -4
data/README.textile
CHANGED
@@ -9,20 +9,21 @@ h2(#amqp_gems_family). How does amq-client relate to amqp gem, amq-protocol and
|
|
9
9
|
|
10
10
|
<pre>
|
11
11
|
|--------------| |-----------------------| |----------------------|
|
12
|
-
|
|
12
|
+
| amq-protocol | | amq-client | | amqp gem, bunny, etc |
|
13
13
|
| - Encoding | ===> | - IO abstraction | ===> | - high-level API |
|
14
14
|
| - Decoding | | - Low-level AMQP API | | - opinionated |
|
15
|
-
| - Framing
|
16
|
-
|--------------|
|
15
|
+
| | | - Framing | | |
|
16
|
+
|--------------| |-----------------------| |----------------------|
|
17
17
|
|
18
18
|
</pre>
|
19
19
|
|
20
|
-
* At the lowest level, "
|
21
|
-
* One level above is "
|
20
|
+
* At the lowest level, "amq-protocol gem":http://github.com/ruby-amqp/amq-protocol takes care of encoding, decoding and framing.
|
21
|
+
* One level above is "amq-client gem":http://github.com/ruby-amqp/amq-client that takes care of network I/O, provides uniform interface for
|
22
22
|
various I/O libraries like "EventMachine":http://rubyeventmachine.com/, "cool.io":http://coolio.github.com/ or good old TCP sockets and implements
|
23
23
|
AMQP protocol entities (queues, exchanges, channels and so on) with emphasis on access to every feature available over API convenience or
|
24
24
|
conciseness.
|
25
|
-
* Finally, end applications use
|
25
|
+
* Finally, end applications use libraries like "amqp gem":http://github.com/ruby-amqp/amqp or "bunny AMQP client":http://github.com/ruby-amqp/bunny
|
26
|
+
|
26
27
|
|
27
28
|
h2. Adapters
|
28
29
|
|
@@ -32,25 +33,46 @@ Version 1.0 will feature 3 adapters:
|
|
32
33
|
* cool.io (asynchronous)
|
33
34
|
* TCP sockets (synchronous)
|
34
35
|
|
36
|
+
h3. EventMachine adapter
|
37
|
+
|
38
|
+
At this point EventMachine adapter is feature-complete, well-tested, supports 5 Ruby implementations
|
39
|
+
(1.8.7, 1.9.2, JRuby, Rubinius, Ruby Enterprise Edition) plus Microsoft Windows(tm) and
|
40
|
+
is used by amqp gem starting with version 0.8.0.
|
41
|
+
|
42
|
+
|
43
|
+
h3. cool.io adapter
|
44
|
+
|
45
|
+
cool.io adapter is on par with EventMachine but is not used by any popular libraries (that we know of).
|
46
|
+
Note that cool.io doesn't work on JRuby and Microsoft Windows(tm).
|
47
|
+
|
48
|
+
|
49
|
+
h3. TCP socket adapter
|
50
|
+
|
51
|
+
TCP socket adapter is largely incomplete.
|
52
|
+
|
53
|
+
|
35
54
|
h2. Installation
|
36
55
|
|
37
|
-
|
56
|
+
amq-client is available from rubygems.org:
|
57
|
+
<pre>gem install amq-client</pre>
|
38
58
|
|
59
|
+
If you use Bundler and want to use the very latest version, add this to your Gemfile:
|
39
60
|
<pre>
|
40
|
-
|
61
|
+
<code>
|
62
|
+
gem "amq-client", :git => "https://github.com/ruby-amqp/amq-client.git"
|
63
|
+
</code>
|
41
64
|
</pre>
|
42
65
|
|
43
66
|
|
44
|
-
h2.
|
67
|
+
h2. Pre-prelease versions
|
45
68
|
|
46
|
-
|
47
|
-
You can install them thusly:
|
69
|
+
Pre-release versions are available from rubygems.org:
|
48
70
|
|
49
71
|
<pre>
|
50
|
-
|
51
|
-
gem install amq-client-nightly.gem
|
72
|
+
gem install amq-client --pre
|
52
73
|
</pre>
|
53
74
|
|
75
|
+
|
54
76
|
h2. See also
|
55
77
|
|
56
78
|
* "API documentation":http://rdoc.info/github/ruby-amqp/amq-client/master/frames
|
data/examples/eventmachine_adapter/authentication/plain_password_with_custom_role_credentials.rb
CHANGED
@@ -12,14 +12,6 @@ EM.run do
|
|
12
12
|
puts "Connected, authenticated"
|
13
13
|
|
14
14
|
|
15
|
-
show_stopper = Proc.new {
|
16
|
-
client.disconnect do
|
17
|
-
puts
|
18
|
-
puts "AMQP connection is now properly closed"
|
19
|
-
EM.stop
|
20
|
-
end
|
21
|
-
}
|
22
|
-
|
23
15
|
show_stopper = Proc.new {
|
24
16
|
client.disconnect do
|
25
17
|
puts
|
@@ -0,0 +1,26 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
__dir = File.join(File.dirname(File.expand_path(__FILE__)))
|
5
|
+
require File.join(__dir, "example_helper")
|
6
|
+
|
7
|
+
EM.run do
|
8
|
+
|
9
|
+
show_stopper = Proc.new {
|
10
|
+
EM.stop
|
11
|
+
}
|
12
|
+
|
13
|
+
Signal.trap "INT", show_stopper
|
14
|
+
Signal.trap "TERM", show_stopper
|
15
|
+
|
16
|
+
EM.add_timer(4, show_stopper)
|
17
|
+
|
18
|
+
AMQ::Client::EventMachineClient.connect(:port => 9689,
|
19
|
+
:vhost => "/amq_client_testbed",
|
20
|
+
:user => "amq_client_gem",
|
21
|
+
:password => "amq_client_gem_password",
|
22
|
+
:connection_timeout => 0.3,
|
23
|
+
:on_tcp_connection_failure => Proc.new { |settings| puts "Failed to connect, as expected"; EM.stop }) do |client|
|
24
|
+
raise "Connected, authenticated. This is not what this example is supposed to do!"
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
__dir = File.join(File.dirname(File.expand_path(__FILE__)))
|
5
|
+
require File.join(__dir, "example_helper")
|
6
|
+
|
7
|
+
begin
|
8
|
+
EventMachine.run do
|
9
|
+
|
10
|
+
show_stopper = Proc.new {
|
11
|
+
EM.stop
|
12
|
+
}
|
13
|
+
|
14
|
+
Signal.trap "INT", show_stopper
|
15
|
+
Signal.trap "TERM", show_stopper
|
16
|
+
|
17
|
+
EventMachine.add_timer(4, show_stopper)
|
18
|
+
|
19
|
+
AMQ::Client::EventMachineClient.connect(:port => 9689,
|
20
|
+
:vhost => "/amq_client_testbed",
|
21
|
+
:user => "amq_client_gem",
|
22
|
+
:password => "amq_client_gem_password",
|
23
|
+
:connection_timeout => 0.3) do |client|
|
24
|
+
raise "Connected, authenticated. This is not what this example is supposed to do!"
|
25
|
+
end
|
26
|
+
end
|
27
|
+
rescue AMQ::Client::TCPConnectionFailed => e
|
28
|
+
puts "TCP connection has failed, as expected. Shutting down…"
|
29
|
+
EventMachine.stop if EventMachine.reactor_running?
|
30
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
examples_dir = File.join(File.dirname(File.expand_path(__FILE__)), "..", "..")
|
5
|
+
__dir = File.join(File.dirname(File.expand_path(__FILE__)), "..")
|
6
|
+
require File.join(__dir, "example_helper")
|
7
|
+
|
8
|
+
certificate_chain_file_path = File.join(examples_dir, "tls_certificates", "client", "cert.pem")
|
9
|
+
client_private_key_file_path = File.join(examples_dir, "tls_certificates", "client", "key.pem")
|
10
|
+
|
11
|
+
EM.run do
|
12
|
+
AMQ::Client::EventMachineClient.connect(:port => 5671,
|
13
|
+
:vhost => "/amq_client_testbed",
|
14
|
+
:user => "amq_client_gem",
|
15
|
+
:password => "amq_client_gem_password",
|
16
|
+
:ssl => {
|
17
|
+
:cert_chain_file => certificate_chain_file_path,
|
18
|
+
:private_key_file => client_private_key_file_path
|
19
|
+
}) do |client|
|
20
|
+
puts "Connected, authenticated. TLS seems to work."
|
21
|
+
|
22
|
+
client.disconnect { puts "Now closing the connection…"; EM.stop }
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
show_stopper = Proc.new {
|
27
|
+
EM.stop
|
28
|
+
}
|
29
|
+
|
30
|
+
Signal.trap "INT", show_stopper
|
31
|
+
Signal.trap "TERM", show_stopper
|
32
|
+
|
33
|
+
# TLS connections take forever and a day
|
34
|
+
# (compared to non-TLS connections) to estabilish.
|
35
|
+
EM.add_timer(8, show_stopper)
|
36
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
-----BEGIN CERTIFICATE-----
|
2
|
+
MIIC5DCCAcygAwIBAgIBAjANBgkqhkiG9w0BAQUFADATMREwDwYDVQQDEwhNeVRl
|
3
|
+
c3RDQTAeFw0xMTA0MTcyMDE4MzNaFw0xMjA0MTYyMDE4MzNaMCcxFDASBgNVBAMT
|
4
|
+
C2dpb3ZlLmxvY2FsMQ8wDQYDVQQKEwZjbGllbnQwggEiMA0GCSqGSIb3DQEBAQUA
|
5
|
+
A4IBDwAwggEKAoIBAQC/4CSqBjpmNXoDt5xU0D4ONG3bQXBV4bJid/nmzIvV67pb
|
6
|
+
v/VpqKxM+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jAKu0of1e1d+1o09JtjJshX4sYREh2/n0umENH1xC
|
7
|
+
yvWnP0eFTithj9qmVcK5UOvoZKSKYT4gtCIpYhRUQZkEhPYKhvxePztjRIeUghkK
|
8
|
+
Qc9Qi0/eARm8d3Zdo0ORnnNNIP+G7BjecmJvTLCP/PBDIGG6r1eybNeulNWddgLg
|
9
|
+
cUq0ACFepxCJW6RdGVrMXhWomScvKssIUMAdDfwM9ffq64MYE2ZLG1OBBPefNI47
|
10
|
+
wz8h9ak15T2ZpKFU9biXLr/SnGhdhNR31d16pAtLAgMBAAGjLzAtMAkGA1UdEwQC
|
11
|
+
MAAwCwYDVR0PBAQDAgeAMBMGA1UdJQQMMAoGCCsGAQUFBwMCMA0GCSqGSIb3DQEB
|
12
|
+
BQUAA4IBAQCVBpz3gZRr1s48SVF4+C9YLzrSaWsvzKZNDKH7RJ4f1VR//ZY5zsYi
|
13
|
+
RqSlzSfLM76Y6Y/Eq0iFshtKmuXHKyA4r/Gp+iiCw4U9Htk91rg98wAPc8wOBgn1
|
14
|
+
OmomH65JpLwxYvUwyt91opGppcqZHWhruhI0fFTFtPIlGKK3KOmJLPpaSvY0YTJ+
|
15
|
+
vaI3D6yQEMQoZ/mcXk928ofJJvOpUEmvjTW4Orz+T8NmiffLb64P50h86bdV+8tw
|
16
|
+
FJx6ix6vLF41LU2iPEYHuuXkA7+M5e+POGscJJCb1p6JKxzI6D/UVDnrbhOlqBa5
|
17
|
+
U45f0oXQ/ndOYUrBRu3BPFdNAjvpa0ld
|
18
|
+
-----END CERTIFICATE-----
|
@@ -0,0 +1 @@
|
|
1
|
+
unique_subject = yes
|
@@ -0,0 +1 @@
|
|
1
|
+
unique_subject = yes
|
@@ -0,0 +1 @@
|
|
1
|
+
V 120416201727Z 01 unknown /CN=giove.local/O=server
|
@@ -0,0 +1,53 @@
|
|
1
|
+
[ ca ]
|
2
|
+
default_ca = testca
|
3
|
+
|
4
|
+
[ testca ]
|
5
|
+
dir = .
|
6
|
+
certificate = $dir/cacert.pem
|
7
|
+
database = $dir/index.txt
|
8
|
+
new_certs_dir = $dir/certs
|
9
|
+
private_key = $dir/private/cakey.pem
|
10
|
+
serial = $dir/serial
|
11
|
+
|
12
|
+
default_crl_days = 7
|
13
|
+
default_days = 365
|
14
|
+
default_md = sha1
|
15
|
+
|
16
|
+
policy = testca_policy
|
17
|
+
x509_extensions = certificate_extensions
|
18
|
+
|
19
|
+
[ testca_policy ]
|
20
|
+
commonName = supplied
|
21
|
+
stateOrProvinceName = optional
|
22
|
+
countryName = optional
|
23
|
+
emailAddress = optional
|
24
|
+
organizationName = optional
|
25
|
+
organizationalUnitName = optional
|
26
|
+
|
27
|
+
[ certificate_extensions ]
|
28
|
+
basicConstraints = CA:false
|
29
|
+
|
30
|
+
[ req ]
|
31
|
+
default_bits = 2048
|
32
|
+
default_keyfile = ./private/cakey.pem
|
33
|
+
default_md = sha1
|
34
|
+
prompt = yes
|
35
|
+
distinguished_name = root_ca_distinguished_name
|
36
|
+
x509_extensions = root_ca_extensions
|
37
|
+
|
38
|
+
[ root_ca_distinguished_name ]
|
39
|
+
commonName = hostname
|
40
|
+
|
41
|
+
[ root_ca_extensions ]
|
42
|
+
basicConstraints = CA:true
|
43
|
+
keyUsage = keyCertSign, cRLSign
|
44
|
+
|
45
|
+
[ client_ca_extensions ]
|
46
|
+
basicConstraints = CA:false
|
47
|
+
keyUsage = digitalSignature
|
48
|
+
extendedKeyUsage = 1.3.6.1.5.5.7.3.2
|
49
|
+
|
50
|
+
[ server_ca_extensions ]
|
51
|
+
basicConstraints = CA:false
|
52
|
+
keyUsage = keyEncipherment
|
53
|
+
extendedKeyUsage = 1.3.6.1.5.5.7.3.1
|
@@ -0,0 +1,27 @@
|
|
1
|
+
-----BEGIN RSA PRIVATE KEY-----
|
2
|
+
MIIEowIBAAKCAQEAyvGXVaNZZV160u3neS7npdVUatA5iRtU2fGwIKLyvX8elrIM
|
3
|
+
3ide82MABIXlMwfD6IJDalN2SGuE+dVQrWpqIhum2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ZkJ7bAl+0cpavdcCgpAoGAetCbO46mDyBcdBIPsiAz
|
19
|
+
fzEBfrkGIyxjKxPAqv/gz2CcXgrT3eiHGLhnZgmLscnSa5e4iTM9JSUQuri6g1HR
|
20
|
+
HRS8zs34fmTd3deuU5d0QzJ9SD81F24B16rPXqmExNP5bER2mpuSvgjXlBmdklye
|
21
|
+
XjM0TxxJsCsWDnb3E3QFrnECgYBSpXqbNZXBK0JqnMTmh1psNQqWWpFQ5jxLScza
|
22
|
+
RMNbzqYcDPJwfAp9jJtY92Q6J6DUmuVSLgJivu88iZPpqHMj9MmikBP160XXqF+W
|
23
|
+
dJLYLml4a/LSFzg0nziJojnYI7LSEorQKRjdoFMEdGDt5eEin9cdgn39c/ASCQyN
|
24
|
+
o0FzcQKBgHifRoEEyyHzepXiv2osPsOV9cEoWROLRaooE7boPISimJ1PCFGON0XT
|
25
|
+
20PmWJL3j3/f2Eqk47x4WpzLOp/OwUqqpaDpImtQX7GD7C+/PbAdbT1Q1Kc9kxc9
|
26
|
+
a5FJg85oJqDPB1yEmYG5nWIlqB3LOX/IdOfYSOUFvRiomwJJoxys
|
27
|
+
-----END RSA PRIVATE KEY-----
|
@@ -0,0 +1 @@
|
|
1
|
+
03
|
@@ -0,0 +1 @@
|
|
1
|
+
02
|
@@ -32,7 +32,7 @@ module AMQ
|
|
32
32
|
|
33
33
|
def self.connect(settings = nil, &block)
|
34
34
|
settings = AMQ::Client::Settings.configure(settings)
|
35
|
-
instance =
|
35
|
+
instance = EventMachine.connect(settings[:host], settings[:port], self, settings)
|
36
36
|
|
37
37
|
unless block.nil?
|
38
38
|
# delay calling block we were given till after we receive
|
@@ -58,6 +58,7 @@ module AMQ
|
|
58
58
|
@settings = args.first
|
59
59
|
@connections = Array.new
|
60
60
|
@on_possible_authentication_failure = @settings[:on_possible_authentication_failure]
|
61
|
+
@on_tcp_connection_failure = @settings[:on_tcp_connection_failure] || Proc.new { |settings| raise AMQ::Client::TCPConnectionFailed.new(settings) }
|
61
62
|
|
62
63
|
@chunk_buffer = ""
|
63
64
|
@connection_deferrable = Deferrable.new
|
@@ -73,7 +74,7 @@ module AMQ
|
|
73
74
|
|
74
75
|
if self.heartbeat_interval > 0
|
75
76
|
@last_server_heartbeat = Time.now
|
76
|
-
|
77
|
+
EventMachine.add_periodic_timer(self.heartbeat_interval, &method(:send_heartbeat))
|
77
78
|
end
|
78
79
|
end # initialize(*args)
|
79
80
|
|
@@ -97,28 +98,44 @@ module AMQ
|
|
97
98
|
# Implementation
|
98
99
|
#
|
99
100
|
|
101
|
+
# EventMachine reactor callback. Is run when TCP connection is estabilished
|
102
|
+
# but before resumption of the network loop. Note that this includes cases
|
103
|
+
# when TCP connection has failed.
|
100
104
|
def post_init
|
101
105
|
reset
|
102
106
|
|
103
|
-
|
107
|
+
# note that upgrading to TLS in #connection_completed causes
|
108
|
+
# Erlang SSL app that RabbitMQ relies on to report
|
109
|
+
# error on TCP connection <0.1465.0>:{ssl_upgrade_error,"record overflow"}
|
110
|
+
# and close TCP connection down. Investigation of this issue is likely
|
111
|
+
# to take some time and to not be worth in as long as #post_init
|
112
|
+
# works fine. MK.
|
113
|
+
upgrade_to_tls_if_necessary
|
104
114
|
|
105
115
|
self.handshake
|
106
116
|
rescue Exception => error
|
107
117
|
raise error
|
108
118
|
end # post_init
|
109
119
|
|
110
|
-
#
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
@
|
116
|
-
while frame = get_next_frame
|
117
|
-
self.receive_frame(AMQ::Client::Framing::String::Frame.decode(frame))
|
118
|
-
end
|
120
|
+
# Called by EventMachine reactor once TCP connection is successfully estabilished.
|
121
|
+
def connection_completed
|
122
|
+
# we only can safely set this value here because EventMachine is a lovely piece of
|
123
|
+
# software that calls #post_init before #unbind even when TCP connection
|
124
|
+
# fails. Yes, it makes as much sense to me MK.
|
125
|
+
@tcp_connection_established = true
|
119
126
|
end
|
120
127
|
|
128
|
+
# Called by EventMachine reactor when
|
129
|
+
#
|
130
|
+
# * We close TCP connection down
|
131
|
+
# * Our peer closes TCP connection down
|
132
|
+
# * There is a network connection issue
|
133
|
+
# * Initial TCP connection fails
|
121
134
|
def unbind
|
135
|
+
if !@tcp_connection_established
|
136
|
+
self.tcp_connection_failed
|
137
|
+
end
|
138
|
+
|
122
139
|
closing!
|
123
140
|
|
124
141
|
@tcp_connection_established = false
|
@@ -142,6 +159,18 @@ module AMQ
|
|
142
159
|
end # unbind
|
143
160
|
|
144
161
|
|
162
|
+
#
|
163
|
+
# EventMachine receives data in chunks, sometimes those chunks are smaller
|
164
|
+
# than the size of AMQP frame. That's why you need to add some kind of buffer.
|
165
|
+
#
|
166
|
+
def receive_data(chunk)
|
167
|
+
@chunk_buffer << chunk
|
168
|
+
while frame = get_next_frame
|
169
|
+
self.receive_frame(AMQ::Client::Framing::String::Frame.decode(frame))
|
170
|
+
end
|
171
|
+
end
|
172
|
+
|
173
|
+
|
145
174
|
|
146
175
|
def on_connection(&block)
|
147
176
|
@connection_deferrable.callback(&block)
|
@@ -153,6 +182,7 @@ module AMQ
|
|
153
182
|
end # connection_successful
|
154
183
|
|
155
184
|
|
185
|
+
|
156
186
|
def on_open(&block)
|
157
187
|
@connection_opened_deferrable.callback(&block)
|
158
188
|
end # on_open(&block)
|
@@ -165,6 +195,7 @@ module AMQ
|
|
165
195
|
end # open_successful
|
166
196
|
|
167
197
|
|
198
|
+
|
168
199
|
def on_disconnection(&block)
|
169
200
|
@disconnection_deferrable.callback(&block)
|
170
201
|
end # on_disconnection(&block)
|
@@ -179,6 +210,16 @@ module AMQ
|
|
179
210
|
|
180
211
|
|
181
212
|
|
213
|
+
def on_tcp_connection_failure(&block)
|
214
|
+
@on_tcp_connection_failure = block
|
215
|
+
end
|
216
|
+
|
217
|
+
def tcp_connection_failed
|
218
|
+
@on_tcp_connection_failure.call(@settings) if @on_tcp_connection_failure
|
219
|
+
end
|
220
|
+
|
221
|
+
|
222
|
+
|
182
223
|
def on_possible_authentication_failure(&block)
|
183
224
|
@on_possible_authentication_failure = block
|
184
225
|
end
|
@@ -190,7 +231,7 @@ module AMQ
|
|
190
231
|
username = @settings[:user] || @settings[:username]
|
191
232
|
password = @settings[:pass] || @settings[:password]
|
192
233
|
|
193
|
-
self.logger.info "[authentication] Credentials are #{username}/#{'*' * password.bytesize}"
|
234
|
+
# self.logger.info "[authentication] Credentials are #{username}/#{'*' * password.bytesize}"
|
194
235
|
|
195
236
|
self.connection = AMQ::Client::Connection.new(self, mechanism, self.encode_credentials(username, password), locale)
|
196
237
|
|
@@ -222,6 +263,16 @@ module AMQ
|
|
222
263
|
else
|
223
264
|
nil
|
224
265
|
end
|
266
|
+
end # get_next_frame
|
267
|
+
|
268
|
+
def upgrade_to_tls_if_necessary
|
269
|
+
tls_options = @settings[:ssl]
|
270
|
+
|
271
|
+
if tls_options.is_a?(Hash)
|
272
|
+
start_tls(tls_options)
|
273
|
+
elsif tls_options
|
274
|
+
start_tls
|
275
|
+
end
|
225
276
|
end
|
226
277
|
end # EventMachineClient
|
227
278
|
end # Client
|
data/lib/amq/client/channel.rb
CHANGED
@@ -7,6 +7,21 @@ module AMQ
|
|
7
7
|
# Adapters
|
8
8
|
#
|
9
9
|
|
10
|
+
class TCPConnectionFailed < StandardError
|
11
|
+
|
12
|
+
#
|
13
|
+
# API
|
14
|
+
#
|
15
|
+
|
16
|
+
attr_reader :settings
|
17
|
+
|
18
|
+
def initialize(settings)
|
19
|
+
@settings = settings
|
20
|
+
|
21
|
+
super("Could not estabilish TCP connection to #{@settings[:host]}:#{@settings[:port]}")
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
10
25
|
# Base exception class for data consistency and framing errors.
|
11
26
|
class InconsistentDataError < StandardError
|
12
27
|
end
|
data/lib/amq/client/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amq-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 1552698946208022683
|
5
5
|
prerelease: 6
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 7
|
9
9
|
- 0
|
10
10
|
- alpha
|
11
|
-
-
|
12
|
-
version: 0.7.0.
|
11
|
+
- 2
|
12
|
+
version: 0.7.0.alpha2
|
13
13
|
platform: ruby
|
14
14
|
authors:
|
15
15
|
- Jakub Stastny
|
@@ -19,7 +19,7 @@ authors:
|
|
19
19
|
autorequire:
|
20
20
|
bindir: bin
|
21
21
|
cert_chain:
|
22
|
-
date: 2011-04-
|
22
|
+
date: 2011-04-18 00:00:00 +04:00
|
23
23
|
default_executable:
|
24
24
|
dependencies:
|
25
25
|
- !ruby/object:Gem::Dependency
|
@@ -111,6 +111,8 @@ files:
|
|
111
111
|
- examples/eventmachine_adapter/channel_close.rb
|
112
112
|
- examples/eventmachine_adapter/channel_flow.rb
|
113
113
|
- examples/eventmachine_adapter/channel_level_exception_handling.rb
|
114
|
+
- examples/eventmachine_adapter/connection_failure_callback.rb
|
115
|
+
- examples/eventmachine_adapter/connection_failure_exception.rb
|
114
116
|
- examples/eventmachine_adapter/example_helper.rb
|
115
117
|
- examples/eventmachine_adapter/exchange_declare.rb
|
116
118
|
- examples/eventmachine_adapter/extensions/rabbitmq/handling_confirm_select_ok.rb
|
@@ -121,12 +123,33 @@ files:
|
|
121
123
|
- examples/eventmachine_adapter/queue_declare.rb
|
122
124
|
- examples/eventmachine_adapter/queue_purge.rb
|
123
125
|
- examples/eventmachine_adapter/queue_unbind.rb
|
126
|
+
- examples/eventmachine_adapter/tls/tls_without_peer_verification.rb
|
124
127
|
- examples/eventmachine_adapter/tx_commit.rb
|
125
128
|
- examples/eventmachine_adapter/tx_rollback.rb
|
126
129
|
- examples/eventmachine_adapter/tx_select.rb
|
127
130
|
- examples/socket_adapter/basics.rb
|
128
131
|
- examples/socket_adapter/connection.rb
|
129
132
|
- examples/socket_adapter/multiple_connections.rb
|
133
|
+
- examples/tls_certificates/client/cert.pem
|
134
|
+
- examples/tls_certificates/client/key.pem
|
135
|
+
- examples/tls_certificates/client/keycert.p12
|
136
|
+
- examples/tls_certificates/client/req.pem
|
137
|
+
- examples/tls_certificates/server/cert.pem
|
138
|
+
- examples/tls_certificates/server/key.pem
|
139
|
+
- examples/tls_certificates/server/keycert.p12
|
140
|
+
- examples/tls_certificates/server/req.pem
|
141
|
+
- examples/tls_certificates/testca/cacert.cer
|
142
|
+
- examples/tls_certificates/testca/cacert.pem
|
143
|
+
- examples/tls_certificates/testca/certs/01.pem
|
144
|
+
- examples/tls_certificates/testca/certs/02.pem
|
145
|
+
- examples/tls_certificates/testca/index.txt
|
146
|
+
- examples/tls_certificates/testca/index.txt.attr
|
147
|
+
- examples/tls_certificates/testca/index.txt.attr.old
|
148
|
+
- examples/tls_certificates/testca/index.txt.old
|
149
|
+
- examples/tls_certificates/testca/openssl.cnf
|
150
|
+
- examples/tls_certificates/testca/private/cakey.pem
|
151
|
+
- examples/tls_certificates/testca/serial
|
152
|
+
- examples/tls_certificates/testca/serial.old
|
130
153
|
- irb.rb
|
131
154
|
- lib/amq/client.rb
|
132
155
|
- lib/amq/client/adapter.rb
|