Class: ThriftClient

AbstractThriftClient show all
Defined in:

Defined Under Namespace

Modules: Simple Classes: NoServersAvailable

Constant Summary

Constant Summary

Constants inherited from AbstractThriftClient

AbstractThriftClient::DEFAULTS, AbstractThriftClient::DEFAULT_WRAPPED_ERRORS, AbstractThriftClient::DISCONNECT_ERRORS

Instance Attribute Summary

Attributes inherited from AbstractThriftClient

#client, #client_class, #client_methods, #current_server, #options, #server_list

Instance Method Summary collapse

Methods inherited from AbstractThriftClient

#connect!, #disconnect!, #inspect

Constructor Details

#initialize(client_class, servers, options = {}) ⇒ ThriftClient

Create a new ThriftClient instance. Accepts an internal Thrift client class (such as CassandraRb::Client), a list of servers with ports, and optional parameters.

Valid optional parameters are:


Which Thrift protocol to use. Defaults to Thrift::BinaryProtocol.


An array of additional parameters to pass to the protocol initialization call. Defaults to [].


Which Thrift transport to use. Defaults to Thrift::Socket.


Which Thrift transport wrapper to use. Defaults to Thrift::FramedTransport.


Which exceptions to catch and retry when sending a request. Defaults to [IOError, Thrift::Exception, Thrift::ApplicationException, Thrift::TransportException, NoServersAvailable]


Whether to reraise errors if no responsive servers are found. Defaults to true.


How many times to retry a request. Defaults to 0.


How many seconds to wait before trying to reconnect to a dead server. Defaults to 1. Set to nil to disable.


How many requests to perform before moving on to the next server in the pool, regardless of error status. Defaults to nil (no limit).


Specify the default timeout in seconds. Defaults to 1.


Specify the connection timeout in seconds. Defaults to 0.1.


Specify additional timeouts on a per-method basis, in seconds. Only works with Thrift::BufferedTransport.


Specify default values to return on a per-method basis, if :raise is set to false.

# File 'lib/thrift_client.rb', line 29

def initialize(client_class, servers, options = {})