stompgem / stomp

A ruby gem for sending and receiving messages from a Stomp protocol compliant message queue. Includes: failover logic, ssl support.
http://stomp.github.com
Apache License 2.0
152 stars 80 forks source link

failover URL regex should allow a single broker to be specified. #66

Closed PaulGale closed 11 years ago

PaulGale commented 11 years ago

AFAIK the failover protocol does not mandate a minimum of two brokers to be specified. Therefore the following is perfectly legal and should be allowed:

failover://(stomp://host1.com:61613)

This is still meaningful as this should cause the client to enter into its connection reestablishment logic should the connection to the single broker be lost.

To permit a single broker failover URL modify the failover regex found in client/utils.rb at line 41 to:

/^failover:(\/\/)?\(stomp(\+(ssl|nio))?:\/\/#{url_regex}(,stomp(\+(ssl|nio))?:\/\/#{url_regex})*\)(\?(.*))?$/

(This also includes the NIO requested fix mentioned in issue #64 )

This also has the consequence when combined with the fix in issue #65 that failover URLs no longer require a :@ prefix before the hostname as seen in a few examples where broker access is not anonymous.

The following URLs will match:

failover://(stomp://host1.com:61613)
failover://(stomp://host1.com:61613,stomp://host2.com:61613)

rather than:

failover://(stomp://:@host1.com:61613)

However, a : is still required if a username but no password is required:

failover://(stomp://someuser:@host1.com:61613)
gmallard commented 11 years ago

Accepted, sans the "+nio" portion.

gmallard commented 11 years ago

Closed, reference: 580a849