discovery_rust

Crates.iodiscovery_rust
lib.rsdiscovery_rust
version0.1.1
sourcesrc
created_at2018-05-30 06:35:15.125096
updated_at2018-09-13 07:06:59.010875
descriptionDiscovery for rust
homepagehttps://github.com/da2018/discovery
repositoryhttps://github.com/da2018/discovery
max_upload_size
id67714
size16,019
(bkda)

documentation

README

diplomat_rust

Service discovery client for Rust based on consul

dependence

You need to set environment variable for test env SERVICE_DISCOVERY_URI

e.g.

export SERVICE_DISCOVERY_URI=consul://discovery.dev.xx.com:8500

Usage

extern crate discovery_rust;

use discovery_rust::Discovery;

fn main() {
    let mut discovery = Discovery::new_discovery("mysql".to_string(), None);
    let addr = discovery.get_address();
    println!("{}", addr);
}

Load balance strategy

Support random and roundrobin.

Tricks

Also you can cover discovery uri by setting environment variable for debug. e.g. SERVICE_NAME -> redis

export REDIS_SERVICE_ADDRESS = '127.0.0.1:8080'

Todo

  • service registry
  • cache
  • unit test
Commit count: 0

cargo fmt