Project

srvy

0.0
No commit activity in last 3 years
No release in over 3 years
SRV-based service discovery
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3
~> 0.7.0
>= 0
>= 0
>= 2.14.1
>= 3.5.0
~> 0.7.1

Runtime

~> 0.8.1
= 0.8.0
 Project Readme

Srvy

Gem Version Build Status Coverage Status Code Climate

A rubygem to integrate SRV-based service discovery into your application

Installation

Add this line to your application's Gemfile:

gem 'srvy'

And then execute:

$ bundle

Or install it yourself as:

$ gem install srvy

Usage

$srvy = Srvy::Resolver.new # default configuration, using the locally configured resolver

# picks a single server by randomized with weight in the highest priority group
$srvy.get_single("db-slaves.mydomain.com") # => "mysql01.mydomain.com:3306"

# to get all services in the highest priority group 
$srvy.get_many("memcache.mydomain.com") # => ["memcache01.mydomain.com:11211", "memcache02.mydomain.com:11211"]

# get all records, including lower priority (e.g. backup) services
$srvy.get_all("db.mydomain.com") # => ["db01.mydomain.com:3306", "db01-failover.mydomain.com:3306"]

#TODO

I havent currently thought of a good api to signal to Srvy that you want to use lower priority services... currently the only way is to use get_all and pick the services out yourself.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request