klomp 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog.md +5 -0
- data/README.md +8 -3
- data/lib/klomp.rb +1 -1
- data/lib/klomp/client.rb +9 -1
- data/test/test_client.rb +13 -0
- metadata +2 -2
data/ChangeLog.md
CHANGED
@@ -1,6 +1,11 @@
|
|
1
1
|
Changes
|
2
2
|
--------------------------------------------------------------------------------
|
3
3
|
|
4
|
+
0.0.8 (2012/8/15)
|
5
|
+
================================================================================
|
6
|
+
|
7
|
+
- add support for specifying vhost at client creation
|
8
|
+
|
4
9
|
0.0.7 (2012/8/15)
|
5
10
|
================================================================================
|
6
11
|
|
data/README.md
CHANGED
@@ -75,9 +75,14 @@ pass implements a `#generate` method that returns a string ID.
|
|
75
75
|
<td>Logger object</td>
|
76
76
|
</tr>
|
77
77
|
<tr>
|
78
|
-
|
79
|
-
|
80
|
-
|
78
|
+
<td>:uuid</td>
|
79
|
+
<td>UUID.new</td>
|
80
|
+
<td>UUID generator object, responds to :generate and returns an ID</td>
|
81
|
+
</tr>
|
82
|
+
<tr>
|
83
|
+
<td>:vhost</td>
|
84
|
+
<td>nil</td>
|
85
|
+
<td>override Apollo virtual host</td>
|
81
86
|
</tr>
|
82
87
|
</table>
|
83
88
|
|
data/lib/klomp.rb
CHANGED
data/lib/klomp/client.rb
CHANGED
@@ -12,7 +12,7 @@ end
|
|
12
12
|
module Klomp
|
13
13
|
|
14
14
|
class Client
|
15
|
-
attr_reader :read_conn, :write_conn
|
15
|
+
attr_reader :read_conn, :write_conn, :all_conn, :vhost
|
16
16
|
attr_accessor :last_connect_exception
|
17
17
|
|
18
18
|
def initialize(uri, options={})
|
@@ -20,6 +20,7 @@ module Klomp
|
|
20
20
|
@auto_reply_to = options.fetch(:auto_reply_to, true)
|
21
21
|
@logger = options.fetch(:logger, nil)
|
22
22
|
@uuid = options.fetch(:uuid) { UUID.new }
|
23
|
+
@vhost = options.fetch(:vhost, nil)
|
23
24
|
|
24
25
|
@fib_retry_backoff = !options.has_key?(:retry_attempts) && !options.has_key?(:retry_delay)
|
25
26
|
|
@@ -135,6 +136,13 @@ module Klomp
|
|
135
136
|
def configure_connections
|
136
137
|
klomp_client = self
|
137
138
|
@all_conn.each do |c|
|
139
|
+
|
140
|
+
if @vhost
|
141
|
+
c.client_pool.each do |client|
|
142
|
+
client.host = @vhost
|
143
|
+
end
|
144
|
+
end
|
145
|
+
|
138
146
|
if @fib_retry_backoff
|
139
147
|
c.before_failover_retry do |conn, attempt|
|
140
148
|
if attempt == 1
|
data/test/test_client.rb
CHANGED
@@ -37,6 +37,19 @@ describe Klomp::Client do
|
|
37
37
|
client.disconnect
|
38
38
|
end
|
39
39
|
|
40
|
+
it 'allows the virtual host to be set' do
|
41
|
+
vhost = "klomp-test"
|
42
|
+
|
43
|
+
client = Klomp::Client.new(@uris, :vhost => vhost)
|
44
|
+
assert_equal vhost, client.vhost
|
45
|
+
|
46
|
+
client.all_conn.each do |failover_client|
|
47
|
+
failover_client.client_pool.each do |conn|
|
48
|
+
assert_equal vhost, conn.host
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
40
53
|
it 'raises an error if authentication fails' do
|
41
54
|
assert_raises OnStomp::ConnectFailedError do
|
42
55
|
Klomp::Client.new(@uris.first.sub('password', 'psswrd')).connect
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: klomp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -94,7 +94,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
94
94
|
version: '0'
|
95
95
|
segments:
|
96
96
|
- 0
|
97
|
-
hash:
|
97
|
+
hash: -4086948349046815425
|
98
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
99
|
none: false
|
100
100
|
requirements:
|