Go to file
Ryan Greenberg 3ec894d476 Extract wrapped exception class creation
The wrapped exception classes are not created until ThriftClient.new
is called with the correct client class. This makes it difficult to
write code like `rescue MyThrift::Client::TransportException` because
the exception class may not exist yet.

Callers may now use ThriftClient.create_wrapped_exception_classes to
ensure the desired classes have been created.
2014-03-19 17:46:06 -07:00
lib Extract wrapped exception class creation 2014-03-19 17:46:06 -07:00
test Extract wrapped exception class creation 2014-03-19 17:46:06 -07:00
.gitignore add travis ci support 2012-11-26 13:15:52 -08:00
.travis.yml add more ruby versions to travis.ci 2013-01-10 19:19:22 -08:00
CHANGELOG only show connection string on NoServersAvailable 2013-04-11 08:59:06 -07:00
Gemfile add travis ci support 2012-11-26 13:15:52 -08:00
LICENSE Add things. 2009-10-13 21:03:15 -07:00
README.rdoc Update README with Travis CI information 2012-11-26 13:31:09 -08:00
Rakefile remove Echoe dependency 2012-11-26 11:50:28 -08:00
thrift_client.gemspec Upgrade to thrift 0.9.0 (closes #49) 2013-01-10 19:04:17 -08:00

README.rdoc

== thrift_client {<img src="https://travis-ci.org/twitter/thrift_client.png" />}[https://travis-ci.org/twitter/thrift_client]

A Thrift client wrapper that encapsulates some common failover behavior.

== Features

* Transparent connection management
* Configurable failover and retry backoff
* Ruby 1.9 compatibility
* ThriftClient::Simple class, for working without generated bindings.

The Github source repository is {here}[http://github.com/twitter/thrift_client/]. Patches and contributions are very welcome.

== Usage

Instantiate a client:

  client = ThriftClient.new(CassandraRb::Client, '127.0.0.1:9160', :retries => 2)

You can then make calls to the server via the <tt>client</tt> instance as if was your internal Thrift client. The connection will be opened lazily and methods will be proxied through.

  client.get_string_list_property("keyspaces")

On failures, the client will try the remaining servers in the list before giving up. See ThriftClient for more.

== Timeouts

Timeouts are enforced per-try, so if you have a timeout of n and do m retries, the total time it could take is n*m.

== Connection Handling

The library will shuffle the host list then work its way down this list, only moving to the next host if it received an error or you've doing more than server_max_requests requests with that host (defaults to 0 which means there's no limit).

Servers that throw an error get marked as dead and will only be retried every server_retry_period seconds (at that time all dead servers are retried, no matter long they've been marked as dead).

== Installation

You need Ruby 1.8 or 1.9. If you have those, just run:

  sudo gem install thrift_client

== Contributing

To contribute changes:

1. Fork the project
2. make your change, adding tests
3. send a pull request to twitter and ryanking

== Reporting problems

The Github issue tracker is {here}[http://github.com/twitter/thrift_client/issues].

== License

Copyright 2009-2012 Twitter, Inc. See included LICENSE file.

The public certificate for this gem is here[http://blog.evanweaver.com/files/evan_weaver-original-public_cert.pem].