Git Product home page Git Product logo

ruby_skynet's Introduction

ruby_skynet

Ruby Client for calling Skynet services, and the server side so that Skynet services can be hosted in Ruby

Client Example

require 'rubygems'
require 'ruby_skynet'

client = RubySkynet::Client.new('TutorialService')
p client.call('AddOne', :value => 5)

For details on installing and running the GoLang Tutorial Service: https://github.com/skynetservices/skynet/wiki/Service-Tutorial

Server Example

require 'rubygems'
require 'ruby_skynet'

# Just echo back any parameters received when the echo method is called
class EchoService
  include RubySkynet::Service

  # Methods implemented by this service
  # Must take a Hash as input
  # Must Return a Hash response or nil for no response
  def echo(params)
    params
  end
end

# Start the server
server = RubySkynet::Server.new

Client to call the above Service

require 'rubygems'
require 'ruby_skynet'

class Echo < RubySkynet::Client
  self.skynet_name = "EchoService"
end

client = Echo.new
p client.echo(:hello => 'world')

Logging

Since ruby_skynet uses SemanticLogger, trace level logging of all TCP/IP calls can be enabled as follows:

require 'rubygems'
require 'ruby_skynet'

SemanticLogger.default_level = :info
SemanticLogger.add_appender('skynet.log')

class Echo < RubySkynet::Client
  self.skynet_name = "EchoService"
end

client = Echo.new
p client.echo(:hello => 'world')

Dependencies

One of the following Service Registry Implementations

Install

Installing for a ZooKeeper centralized service registry - Recommended

gem install zk
gem install ruby_skynet

OR, Installing for a Doozer centralized service registry

gem install ruby_doozer
gem install ruby_skynet

Development

Want to contribute to Ruby Skynet?

First clone the repo and run the tests:

git clone git://github.com/skynetservices/ruby_skynet.git
cd ruby_skynet
ruby -S rake test

Feel free to submit an issue and we'll try to resolve it.

Contributing

Once you've made your great commits:

  1. Fork ruby_skynet
  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,2013 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.

ruby_skynet's People

Contributors

erikstmartin avatar reidmorrison avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.