stomp 1.2.14 → 1.2.16

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.
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MDM0Njc0MjJhMzYzOTBjZGQ0NGZiZTM4MDA2MzRlNzgwZmE2M2JmZg==
5
+ data.tar.gz: !binary |-
6
+ YmY5YmNlNTFkMTEwMzFlMDRjYWJlNWQ4MmRjZWEwNWJmNjU3YTZjZA==
7
+ !binary "U0hBNTEy":
8
+ metadata.gz: !binary |-
9
+ ZmRmZWI0MGUyMDZjNDM2Yjc3YjY5ZmRiODQwZmNhZDIwYmNiOGY0NDczMWI2
10
+ Nzg2NWNiMWQ4YmY4YWQ5MzRhNjAwOTZlYWUwZDU4ZDhhYWNkMmJmYmI1MDFl
11
+ ZDFkOWNmMDdjZTgxZmQ3NmZkYTk5YmYzMDk2ZTljYmE4ZjhlOTk=
12
+ data.tar.gz: !binary |-
13
+ MjQ5YWQ3MjYwMjAyYWVkNDRiY2Q1ZGUxYTU0MzFhOTE1NGNlYjU1MGRjN2I3
14
+ NzU4ZDJkNmZiYTZkNjU3YmQ0MTQxOGUzM2ZhMDIxNmY4NGYwNDhjYTcxNGQ5
15
+ MWVmNzI5ZjIwMjEwN2E2ZjM0MzBkM2RmZmEwMjk3NTNiNWM2MzM=
@@ -1,3 +1,13 @@
1
+ == 1.2.16 20130812
2
+
3
+ * Stomp::Client's should expose connection's host params
4
+
5
+ == 1.2.15 20130809
6
+
7
+ * Add user-specified timeout for initial CONNECTED/ERROR frame read.
8
+ * Eliminate dup Timeout::timeout in ssl connect
9
+ * Add license information to gemspec (#69)
10
+
1
11
  == 1.2.14 20130819
2
12
 
3
13
  * Version bump (1.2.13 release had Stomp::Version of 1.1.12.)
@@ -12,6 +12,8 @@ An implementation of the Stomp protocol for Ruby. See:
12
12
 
13
13
  See _CHANGELOG.rdoc_ for details.
14
14
 
15
+ * Gem version 1.2.16. Fixed Stomp::Client to expose its connection's host parameters.
16
+ * Gem version 1.2.15. Timeout cleanup, added license info to gemspec.
15
17
  * Gem version 1.2.14. Cleanup.
16
18
  * Gem version 1.2.13. Stomp::Client#unreceive max_redeliveries fix.
17
19
  * Gem version 1.2.12. Miscellaneous issue fixes and cleanup.
@@ -60,6 +62,7 @@ See _CHANGELOG.rdoc_ for details.
60
62
  :fast_hbs_adjust => 0.0, # Fast heartbeat senders sleep adjustment, seconds, needed ...
61
63
  # For fast heartbeat senders. 'fast' == YMMV. If not
62
64
  # correct for your environment, expect unnecessary fail overs
65
+ :connread_timeout => 0, # Timeout during CONNECT for read of CONNECTED/ERROR, secs
63
66
  }
64
67
 
65
68
  # for client
data/Rakefile CHANGED
@@ -30,6 +30,7 @@ begin
30
30
  gem.name = "stomp"
31
31
  gem.version = Stomp::Version::STRING
32
32
  gem.summary = %Q{Ruby client for the Stomp messaging protocol}
33
+ gem.license = "Apache 2.0"
33
34
  gem.description = %Q{Ruby client for the Stomp messaging protocol. Note that this gem is no longer supported on rubyforge.}
34
35
  gem.email = ["brianm@apache.org", 'marius@stones.com', 'morellon@gmail.com',
35
36
  'allard.guy.m@gmail.com' ]
@@ -13,25 +13,20 @@ module Stomp
13
13
  return false unless params.is_a?(Hash)
14
14
 
15
15
  @parameters = params
16
- first_host = @parameters[:hosts][0]
17
- @login = first_host[:login]
18
- @passcode = first_host[:passcode]
19
- @host = first_host[:host]
20
- @port = first_host[:port] || Connection::default_port(first_host[:ssl])
21
- @reliable = true
16
+ @parameters[:reliable] = true
17
+
22
18
  true
23
19
  end
24
20
 
25
21
  def parse_stomp_url(login)
26
22
  regexp = /^stomp:\/\/#{URL_REPAT}/
27
- return false unless login =~ regexp
28
-
29
- @login = $3 || ""
30
- @passcode = $4 || ""
31
- @host = $5
32
- @port = $6.to_i
23
+ return false unless url = regexp.match(login)
33
24
 
34
- @reliable = false
25
+ @parameters = { :reliable => false,
26
+ :hosts => [ { :login => url[3] || "",
27
+ :passcode => url[4] || "",
28
+ :host => url[5],
29
+ :port => url[6].to_i} ] }
35
30
  true
36
31
  end
37
32
 
@@ -40,31 +35,28 @@ module Stomp
40
35
  rval = nil
41
36
  if md = FAILOVER_REGEX.match(login)
42
37
  finhosts = parse_hosts(login)
43
- #
44
- @login = finhosts[0][:login] || ""
45
- @passcode = finhosts[0][:passcode] || ""
46
- @host = finhosts[0][:host] || ""
47
- @port = finhosts[0][:port] || ""
48
- #
38
+
49
39
  options = {}
50
- if md_last = md[md.size-1]
40
+ if md_last = md[-1]
51
41
  parts = md_last.split(/&|=/)
52
- raise Stomp::Error::MalformedFailoverOptionsError unless (parts.size % 2 ) == 0
42
+ raise Stomp::Error::MalformedFailoverOptionsError unless ( parts.size % 2 ) == 0
53
43
  options = Hash[*parts]
54
44
  end
55
- @parameters = {:hosts => finhosts}.merge! filter_options(options)
56
- @reliable = true
45
+
46
+ @parameters = {:hosts => finhosts}.merge!(filter_options(options))
47
+
48
+ @parameters[:reliable] = true
57
49
  rval = true
58
50
  end
59
51
  rval
60
52
  end
61
53
 
62
54
  def parse_positional_params(login, passcode, host, port, reliable)
63
- @login = login
64
- @passcode = passcode
65
- @host = host
66
- @port = port.to_i
67
- @reliable = reliable
55
+ @parameters = { :reliable => reliable,
56
+ :hosts => [ { :login => login,
57
+ :passcode => passcode,
58
+ :host => host,
59
+ :port => port.to_i } ] }
68
60
  true
69
61
  end
70
62
 
@@ -108,9 +100,12 @@ end
108
100
 
109
101
  # A very basic check of required arguments.
110
102
  def check_arguments!()
111
- raise ArgumentError if @host.nil? || @host.empty?
112
- raise ArgumentError if @port.nil? || @port == '' || @port < 1 || @port > 65535
113
- raise ArgumentError unless @reliable.is_a?(TrueClass) || @reliable.is_a?(FalseClass)
103
+ first_host = @parameters && @parameters[:hosts] && @parameters[:hosts].first
104
+
105
+ raise ArgumentError if first_host.nil?
106
+ raise ArgumentError if first_host[:host].nil? || first_host[:host].empty?
107
+ raise ArgumentError if first_host[:port].nil? || first_host[:port] == '' || first_host[:port] < 1 || first_host[:port] > 65535
108
+ raise ArgumentError unless @parameters[:reliable].is_a?(TrueClass) || @parameters[:reliable].is_a?(FalseClass)
114
109
  end
115
110
 
116
111
  # filter_options returns a new Hash of filtered options.
@@ -149,7 +144,7 @@ end
149
144
  while true
150
145
  message = @connection.receive
151
146
  # AMQ specific behavior
152
- if message.nil? && (!@reliable)
147
+ if message.nil? && (!@parameters[:reliable])
153
148
  raise Stomp::Error::NilMessageError
154
149
  end
155
150
  if message # message can be nil on rapid AMQ stop / start sequences
@@ -12,28 +12,24 @@ module Stomp
12
12
  private
13
13
 
14
14
  # Really read from the wire.
15
- def _receive(read_socket)
15
+ def _receive(read_socket, connread = false)
16
16
  @read_semaphore.synchronize do
17
- line = ''
18
- if @protocol == Stomp::SPL_10 || (@protocol >= Stomp::SPL_11 && !@hbr)
19
- if @jruby
20
- # Handle JRuby specific behavior.
21
- while true
22
- line = read_socket.gets # Data from wire
23
- break unless line == "\n"
24
- line = ''
17
+ line = nil
18
+ if connread
19
+ begin
20
+ Timeout::timeout(@connread_timeout, Stomp::Error::ConnectReadTimeout) do
21
+ line = _init_line_read(read_socket)
25
22
  end
26
- else
27
- line = read_socket.gets # The old way
28
- end
29
- else # We are >= 1.1 *AND* receiving heartbeats.
30
- while true
31
- line = read_socket.gets # Data from wire
32
- break unless line == "\n"
33
- line = ''
34
- @lr = Time.now.to_f
23
+ rescue Stomp::Error::ConnectReadTimeout => ex
24
+ if @reliable
25
+ _reconn_prep()
26
+ end
27
+ raise ex
35
28
  end
29
+ else
30
+ line = _init_line_read(read_socket)
36
31
  end
32
+ #
37
33
  return nil if line.nil?
38
34
  # p [ "wiredatain_01", line ]
39
35
  line = _normalize_line_end(line) if @protocol >= Stomp::SPL_12
@@ -290,7 +286,8 @@ module Stomp
290
286
  end
291
287
 
292
288
  Timeout::timeout(@connect_timeout, Stomp::Error::SocketOpenTimeout) do
293
- ssl = OpenSSL::SSL::SSLSocket.new(open_tcp_socket, ctx)
289
+ tcp_socket = TCPSocket.open(@host, @port)
290
+ ssl = OpenSSL::SSL::SSLSocket.new(tcp_socket, ctx)
294
291
  ssl.hostname = @host if ssl.respond_to? :hostname=
295
292
  ssl.sync_close = true # Sync ssl close with underlying TCP socket
296
293
  ssl.connect
@@ -345,7 +342,9 @@ module Stomp
345
342
 
346
343
  @closed = false
347
344
  if @parameters # nil in some rspec tests
348
- @reconnect_delay = @parameters[:initial_reconnect_delay] ? @parameters[:initial_reconnect_delay] : 0.01
345
+ unless @reconnect_delay
346
+ @reconnect_delay = @parameters[:initial_reconnect_delay] ? @parameters[:initial_reconnect_delay] : 0.01
347
+ end
349
348
  end
350
349
  # Use keepalive
351
350
  used_socket.setsockopt(Socket::SOL_SOCKET, Socket::SO_KEEPALIVE, true)
@@ -364,7 +363,7 @@ module Stomp
364
363
  else
365
364
  _transmit(used_socket, Stomp::CMD_CONNECT, headers)
366
365
  end
367
- @connection_frame = _receive(used_socket)
366
+ @connection_frame = _receive(used_socket, true)
368
367
  _post_connect
369
368
  @disconnect_receipt = nil
370
369
  @session = @connection_frame.headers["session"] if @connection_frame
@@ -374,6 +373,30 @@ module Stomp
374
373
  }
375
374
  end
376
375
 
376
+ def _init_line_read(read_socket)
377
+ line = ''
378
+ if @protocol == Stomp::SPL_10 || (@protocol >= Stomp::SPL_11 && !@hbr)
379
+ if @jruby
380
+ # Handle JRuby specific behavior.
381
+ while true
382
+ line = read_socket.gets # Data from wire
383
+ break unless line == "\n"
384
+ line = ''
385
+ end
386
+ else
387
+ line = read_socket.gets # The old way
388
+ end
389
+ else # We are >= 1.1 *AND* receiving heartbeats.
390
+ while true
391
+ line = read_socket.gets # Data from wire
392
+ break unless line == "\n"
393
+ line = ''
394
+ @lr = Time.now.to_f
395
+ end
396
+ end
397
+ line
398
+ end
399
+
377
400
  end # class Connection
378
401
 
379
402
  end # module Stomp
@@ -182,6 +182,7 @@ module Stomp
182
182
  :max_hbread_fails => 0,
183
183
  :max_hbrlck_fails => 0,
184
184
  :fast_hbs_adjust => 0.0,
185
+ :connread_timeout => 0,
185
186
  }
186
187
 
187
188
  res_params = default_params.merge(params)
@@ -191,7 +192,7 @@ module Stomp
191
192
  return res_params
192
193
  end
193
194
 
194
- # change_host selects the next host for retires.
195
+ # change_host selects the next host for retries.
195
196
  def change_host
196
197
  @parameters[:hosts] = @parameters[:hosts].sort_by { rand } if @parameters[:randomize]
197
198
 
@@ -204,7 +205,6 @@ module Stomp
204
205
  @port = current_host[:port] || Connection::default_port(@ssl)
205
206
  @login = current_host[:login] || ""
206
207
  @passcode = current_host[:passcode] || ""
207
-
208
208
  end
209
209
 
210
210
  # max_reconnect_attempts? returns nil or the number of maximum reconnect
@@ -2,6 +2,7 @@
2
2
 
3
3
  require 'thread'
4
4
  require 'digest/sha1'
5
+ require 'forwardable'
5
6
 
6
7
  module Stomp
7
8
 
@@ -11,25 +12,14 @@ module Stomp
11
12
  # Receives all happen in one thread, so consider not doing much processing
12
13
  # in that thread if you have much message volume.
13
14
  class Client
15
+ extend Forwardable
14
16
 
15
- # The login ID used by the client.
16
- attr_reader :login
17
-
18
- # The login credentials used by the client.
19
- attr_reader :passcode
20
-
21
- # The Stomp host specified by the client.
22
- attr_reader :host
23
-
24
- # The Stomp host's listening port.
25
- attr_reader :port
26
-
27
- # Is this connection reliable?
28
- attr_reader :reliable
29
-
30
- # Parameters Hash, possibly nil for a non-hashed connect.
17
+ # Parameters hash
31
18
  attr_reader :parameters
32
19
 
20
+ def_delegators :@connection, :login, :passcode, :port, :host, :ssl
21
+ def_delegator :@parameters, :reliable
22
+
33
23
  # A new Client object can be initialized using three forms:
34
24
  #
35
25
  # Hash (this is the recommended Client initialization method):
@@ -58,6 +48,7 @@ module Stomp
58
48
  # :max_hbread_fails => 0,
59
49
  # :max_hbrlck_fails => 0,
60
50
  # :fast_hbs_adjust => 0.0,
51
+ # :connread_timeout => 0,
61
52
  # }
62
53
  #
63
54
  # e.g. c = Stomp::Client.new(hash)
@@ -99,12 +90,8 @@ module Stomp
99
90
  end
100
91
 
101
92
  def create_connection(autoflush)
102
- if @parameters
103
- @connection = Connection.new(@parameters)
104
- else
105
- @connection = Connection.new(@login, @passcode, @host, @port, @reliable)
106
- @connection.autoflush = autoflush
107
- end
93
+ @connection = Connection.new(@parameters)
94
+ @connection.autoflush = autoflush
108
95
  end
109
96
  private :create_connection
110
97
 
@@ -38,6 +38,9 @@ module Stomp
38
38
  # dynamically by calling code.
39
39
  attr_accessor :autoflush
40
40
 
41
+ # Currently-connected host and port
42
+ attr_reader :host, :port
43
+
41
44
  # default_port returns the default port used by the gem for TCP or SSL.
42
45
  def self.default_port(ssl)
43
46
  ssl ? 61612 : 61613
@@ -71,6 +74,7 @@ module Stomp
71
74
  # :max_hbread_fails => 0,
72
75
  # :max_hbrlck_fails => 0,
73
76
  # :fast_hbs_adjust => 0.0,
77
+ # :connread_timeout => 0,
74
78
  # }
75
79
  #
76
80
  # e.g. c = Stomp::Connection.new(hash)
@@ -117,7 +121,8 @@ module Stomp
117
121
  @usecrlf = false # If true, use \r\n as line ends (1.2 only)
118
122
  @max_hbread_fails = 0 # 0 means never retry for HB read failures
119
123
  @max_hbrlck_fails = 0 # 0 means never retry for HB read lock failures
120
- @fast_hbs_adjust = 0.0 # Fast heartbeat senders sleep adjustment
124
+ @fast_hbs_adjust = 0.0 # Fast heartbeat senders sleep adjustment
125
+ @connread_timeout = 0 # Connect read CONNECTED/ERROR timeout
121
126
  warn "login looks like a URL, do you have the correct parameters?" if @login =~ /:\/\//
122
127
  end
123
128
 
@@ -153,6 +158,7 @@ module Stomp
153
158
  @max_hbread_fails = @parameters[:max_hbread_fails]
154
159
  @max_hbrlck_fails = @parameters[:max_hbrlck_fails]
155
160
  @fast_hbs_adjust = @parameters[:fast_hbs_adjust]
161
+ @connread_timeout = @parameters[:connread_timeout]
156
162
  #sets the first host to connect
157
163
  change_host
158
164
  end
@@ -213,6 +213,14 @@ module Stomp
213
213
  end
214
214
  end
215
215
 
216
+ # ConnectReadTimeout is raised if:
217
+ # * A read for CONNECTED/ERROR is untimely
218
+ class ConnectReadTimeout < RuntimeError
219
+ def message
220
+ "Connect read for CONNECTED/ERROR timeout"
221
+ end
222
+ end
223
+
216
224
  end # module Error
217
225
 
218
226
  end # module Stomp
@@ -6,7 +6,7 @@ module Stomp
6
6
  module Version #:nodoc: all
7
7
  MAJOR = 1
8
8
  MINOR = 2
9
- PATCH = 14
9
+ PATCH = 16
10
10
  STRING = "#{MAJOR}.#{MINOR}.#{PATCH}"
11
11
  end
12
12
  end
@@ -7,8 +7,8 @@ require 'client_shared_examples'
7
7
  describe Stomp::Client do
8
8
 
9
9
  before(:each) do
10
- @mock_connection = mock('connection', :autoflush= => true)
11
- Stomp::Connection.stub!(:new).and_return(@mock_connection)
10
+ @mock_connection = double('connection', :autoflush= => true)
11
+ Stomp::Connection.stub(:new).and_return(@mock_connection)
12
12
  end
13
13
 
14
14
  describe "(created with no params)" do
@@ -33,6 +33,29 @@ describe Stomp::Client do
33
33
 
34
34
  end
35
35
 
36
+ describe 'delegated params' do
37
+ before :each do
38
+ @mock_connection = double('connection', :autoflush= => true,
39
+ :login => 'dummy login',
40
+ :passcode => 'dummy passcode',
41
+ :port => 12345,
42
+ :host => 'dummy host',
43
+ :ssl => 'dummy ssl')
44
+ Stomp::Connection.stub(:new).and_return(@mock_connection)
45
+ @client = Stomp::Client.new
46
+ end
47
+
48
+ describe 'it should delegate parameters to its connection' do
49
+ subject { @client }
50
+
51
+ its(:login) { should eql 'dummy login' }
52
+ its(:passcode) { should eql 'dummy passcode' }
53
+ its(:port) { should eql 12345 }
54
+ its(:host) { should eql 'dummy host' }
55
+ its(:ssl) { should eql 'dummy ssl' }
56
+ end
57
+ end
58
+
36
59
  describe "(autoflush)" do
37
60
  it "should delegate to the connection for accessing the autoflush property" do
38
61
  @mock_connection.should_receive(:autoflush)
@@ -98,17 +121,17 @@ describe Stomp::Client do
98
121
 
99
122
 
100
123
  describe "(created with positional params)" do
101
-
102
124
  before(:each) do
103
125
  @client = Stomp::Client.new('testlogin', 'testpassword', 'localhost', '12345', false)
104
126
  end
105
127
 
106
128
  it "should properly parse the URL provided" do
107
- @client.login.should eql('testlogin')
108
- @client.passcode.should eql('testpassword')
109
- @client.host.should eql('localhost')
110
- @client.port.should eql(12345)
111
- @client.reliable.should be_false
129
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => 'testlogin',
130
+ :passcode => 'testpassword',
131
+ :host => 'localhost',
132
+ :port => 12345}],
133
+ :reliable => false)
134
+ Stomp::Client.new('testlogin', 'testpassword', 'localhost', '12345', false)
112
135
  end
113
136
 
114
137
  it_should_behave_like "standard Client"
@@ -122,11 +145,12 @@ describe Stomp::Client do
122
145
  end
123
146
 
124
147
  it "should properly parse the URL provided" do
125
- @client.login.should eql('')
126
- @client.passcode.should eql('')
127
- @client.host.should eql('foobar')
128
- @client.port.should eql(12345)
129
- @client.reliable.should be_false
148
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => '',
149
+ :passcode => '',
150
+ :host => 'foobar',
151
+ :port => 12345}],
152
+ :reliable => false)
153
+ Stomp::Client.new('stomp://foobar:12345')
130
154
  end
131
155
 
132
156
  it_should_behave_like "standard Client"
@@ -140,11 +164,12 @@ describe Stomp::Client do
140
164
  end
141
165
 
142
166
  it "should properly parse the URL provided" do
143
- @client.login.should eql('')
144
- @client.passcode.should eql('')
145
- @client.host.should eql('foo-bar')
146
- @client.port.should eql(12345)
147
- @client.reliable.should be_false
167
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => '',
168
+ :passcode => '',
169
+ :host => 'foo-bar',
170
+ :port => 12345}],
171
+ :reliable => false)
172
+ Stomp::Client.new('stomp://foo-bar:12345')
148
173
  end
149
174
 
150
175
  it_should_behave_like "standard Client"
@@ -158,11 +183,12 @@ describe Stomp::Client do
158
183
  end
159
184
 
160
185
  it "should properly parse the URL provided" do
161
- @client.login.should eql('test-login')
162
- @client.passcode.should eql('testpasscode')
163
- @client.host.should eql('foobar')
164
- @client.port.should eql(12345)
165
- @client.reliable.should be_false
186
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => 'test-login',
187
+ :passcode => 'testpasscode',
188
+ :host => 'foobar',
189
+ :port => 12345}],
190
+ :reliable => false)
191
+ Stomp::Client.new('stomp://test-login:testpasscode@foobar:12345')
166
192
  end
167
193
 
168
194
  it_should_behave_like "standard Client"
@@ -176,11 +202,12 @@ describe Stomp::Client do
176
202
  end
177
203
 
178
204
  it "should properly parse the URL provided" do
179
- @client.login.should eql('test-login')
180
- @client.passcode.should eql('testpasscode')
181
- @client.host.should eql('foo-bar')
182
- @client.port.should eql(12345)
183
- @client.reliable.should be_false
205
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => 'test-login',
206
+ :passcode => 'testpasscode',
207
+ :host => 'foo-bar',
208
+ :port => 12345}],
209
+ :reliable => false)
210
+ Stomp::Client.new('stomp://test-login:testpasscode@foo-bar:12345')
184
211
  end
185
212
 
186
213
  it_should_behave_like "standard Client"
@@ -197,11 +224,12 @@ describe Stomp::Client do
197
224
  end
198
225
 
199
226
  it "should properly parse the URL provided" do
200
- @client.login.should eql('')
201
- @client.passcode.should eql('')
202
- @client.host.should eql('host.foobar.com')
203
- @client.port.should eql(12345)
204
- @client.reliable.should be_false
227
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => '',
228
+ :passcode => '',
229
+ :host => 'host.foobar.com',
230
+ :port => 12345}],
231
+ :reliable => false)
232
+ Stomp::Client.new('stomp://host.foobar.com:12345')
205
233
  end
206
234
 
207
235
  it_should_behave_like "standard Client"
@@ -215,11 +243,12 @@ describe Stomp::Client do
215
243
  end
216
244
 
217
245
  it "should properly parse the URL provided" do
218
- @client.login.should eql('testlogin')
219
- @client.passcode.should eql('testpasscode')
220
- @client.host.should eql('host.foobar.com')
221
- @client.port.should eql(12345)
222
- @client.reliable.should be_false
246
+ Stomp::Connection.should_receive(:new).with(:hosts => [{:login => 'testlogin',
247
+ :passcode => 'testpasscode',
248
+ :host => 'host.foobar.com',
249
+ :port => 12345}],
250
+ :reliable => false)
251
+ Stomp::Client.new('stomp://testlogin:testpasscode@host.foobar.com:12345')
223
252
  end
224
253
 
225
254
  it_should_behave_like "standard Client"
@@ -236,7 +265,8 @@ describe Stomp::Client do
236
265
  :back_off_multiplier => 2,
237
266
  :max_reconnect_attempts => 0,
238
267
  :randomize => false,
239
- :connect_timeout => 0
268
+ :connect_timeout => 0,
269
+ :reliable => true
240
270
  }
241
271
  end
242
272
  it "should properly parse a URL with failover://" do
@@ -303,14 +333,15 @@ describe Stomp::Client do
303
333
  url = "failover:(stomp://login1:passcode1@localhost:61616,stomp://login2:passcode2@remotehost:61617)?#{query}"
304
334
 
305
335
  #
306
- @parameters = {
336
+ @parameters = {
307
337
  :initial_reconnect_delay => 5.0,
308
338
  :max_reconnect_delay => 60.0,
309
339
  :use_exponential_back_off => false,
310
340
  :back_off_multiplier => 3,
311
341
  :max_reconnect_attempts => 4,
312
342
  :randomize => true,
313
- :connect_timeout => 0
343
+ :connect_timeout => 0,
344
+ :reliable => true
314
345
  }
315
346
 
316
347
  @parameters[:hosts] = [
@@ -28,11 +28,12 @@ describe Stomp::Connection do
28
28
  :max_hbread_fails => 0,
29
29
  :max_hbrlck_fails => 0,
30
30
  :fast_hbs_adjust => 0.0,
31
+ :connread_timeout => 0,
31
32
  }
32
33
 
33
34
  #POG:
34
35
  class Stomp::Connection
35
- def _receive( s )
36
+ def _receive( s, connread = false )
36
37
  end
37
38
  end
38
39
 
@@ -96,6 +97,7 @@ describe Stomp::Connection do
96
97
  :maxHbreadFails => 0,
97
98
  :maxHbrlckFails => 0,
98
99
  :fastHbsAdjust => 0.0,
100
+ :connreadTimeout => 0,
99
101
  }
100
102
 
101
103
  @connection = Stomp::Connection.new(used_hash)
@@ -350,6 +352,7 @@ describe Stomp::Connection do
350
352
  :max_hbread_fails => 0,
351
353
  :max_hbrlck_fails => 0,
352
354
  :fast_hbs_adjust => 0.0,
355
+ :connread_timeout => 0,
353
356
  }
354
357
 
355
358
  used_hash = {
@@ -389,6 +392,7 @@ describe Stomp::Connection do
389
392
  :max_hbread_fails => 123,
390
393
  :max_hbrlck_fails => 456,
391
394
  :fast_hbs_adjust => 0.2,
395
+ :connread_timeout => 42,
392
396
  }
393
397
 
394
398
  @connection = Stomp::Connection.new(used_hash)
@@ -438,7 +442,6 @@ describe Stomp::Connection do
438
442
  @connection.instance_variable_set(:@connection_attempts, limit)
439
443
  @connection.send(:max_reconnect_attempts?).should be_true
440
444
  end
441
-
442
445
  # These should be raised for the user to deal with
443
446
  it "should not rescue MaxReconnectAttempts" do
444
447
  @connection = Stomp::Connection.new(@parameters)
@@ -5,7 +5,8 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{stomp}
8
- s.version = "1.2.14"
8
+ s.version = "1.2.16"
9
+ s.license = "Apache 2.0"
9
10
 
10
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
12
  s.authors = ["Brian McCallister", "Marius Mathiesen", "Thiago Morello", "Guy M. Allard"]
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stomp
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.14
5
- prerelease:
4
+ version: 1.2.16
6
5
  platform: ruby
7
6
  authors:
8
7
  - Brian McCallister
@@ -17,7 +16,6 @@ dependencies:
17
16
  - !ruby/object:Gem::Dependency
18
17
  name: rspec
19
18
  requirement: !ruby/object:Gem::Requirement
20
- none: false
21
19
  requirements:
22
20
  - - ! '>='
23
21
  - !ruby/object:Gem::Version
@@ -25,7 +23,6 @@ dependencies:
25
23
  type: :development
26
24
  prerelease: false
27
25
  version_requirements: !ruby/object:Gem::Requirement
28
- none: false
29
26
  requirements:
30
27
  - - ! '>='
31
28
  - !ruby/object:Gem::Version
@@ -160,26 +157,26 @@ files:
160
157
  - test/test_urlogin.rb
161
158
  - test/tlogger.rb
162
159
  homepage: https://github.com/stompgem/stomp
163
- licenses: []
160
+ licenses:
161
+ - Apache 2.0
162
+ metadata: {}
164
163
  post_install_message:
165
164
  rdoc_options: []
166
165
  require_paths:
167
166
  - lib
168
167
  required_ruby_version: !ruby/object:Gem::Requirement
169
- none: false
170
168
  requirements:
171
169
  - - ! '>='
172
170
  - !ruby/object:Gem::Version
173
171
  version: '0'
174
172
  required_rubygems_version: !ruby/object:Gem::Requirement
175
- none: false
176
173
  requirements:
177
174
  - - ! '>='
178
175
  - !ruby/object:Gem::Version
179
176
  version: '0'
180
177
  requirements: []
181
178
  rubyforge_project:
182
- rubygems_version: 1.8.25
179
+ rubygems_version: 2.0.5
183
180
  signing_key:
184
181
  specification_version: 3
185
182
  summary: Ruby client for the Stomp messaging protocol