resilient_socket

A Resilient TCP Socket Client with built-in timeouts, retries, and logging

Introduction

Resilient Socket implements resilience features that most developers wish was already included in the standard Ruby libraries.

With so many "client" libraries to servers such us memcache, MongoDB, Redis, etc. their focus on the communication formats and messaging interactions. As a result adding resilience is usually an after thought.

More importantly the way that each client implements connection failure handling varies dramatically. The purpose of this library is to try and extract the best of all the socket error handling out there and create a consistent way of dealing with connection failures.

Another important feature is that the connect and read API's use timeout's to prevent a network issue from "hanging" the client program.

It is expected that this library will undergo significant changes until V1 is reached as input is gathered from client library developers. After V1 the interface should not break existing users

TCPClient API

Standard Logging methods

TCPClient should be a drop in replacement for TCPSocket when used as a client in any way needed other than for the initializer that accepts several new options to adjust the retry logic

Dependencies

  • Ruby MRI 1.8.7 (or above), Ruby 1.9.3, Or JRuby 1.6.3 (or above)
  • SemanticLogger

Install

gem install resilient_socket

Future

Development

Want to contribute to Resilient Socket?

First clone the repo and run the tests:

git clone git://github.com/ClarityServices/resilient_socket.git
cd resilient_socket
jruby -S rake test

Feel free to ping the mailing list with any issues and we'll try to resolve it.

Contributing

Once you've made your great commits:

  1. Fork resilient_socket
  2. Create a topic branch - git checkout -b my_branch
  3. Push to your branch - git push origin my_branch
  4. Create an Issue with a link to your branch
  5. That's it!

Meta

This project uses Semantic Versioning.

Authors

Reid Morrison :: [email protected] :: @reidmorrison

License

Copyright 2012 Clarity Services, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.