Giter Club home page Giter Club logo

ecumene-scala's Introduction

What is ecumene-scala?

This is the Scala client/worker library for the Ecumene RPC protocol.

#Features

  • Fast: Ecumene is based on ZeroMQ and MessagePack, without the overhead of HTTP.
  • Natural: Ecumene is designed with the interoperability with native function calls in mind, and tries to abstract away the difference between local and remote function calls.
  • Composable: Ecumene supports the idea of "composable services," where network services can be composed the same way as higher-order functions.

Building and Installation

Simply run sbt compile.

Getting Started

MyClient.scala:

import scala.util.{ Try, Success, Failure }

import io.ecumene.client._
import io.ecumene.core.Implicits._

object MyClient {

  val greet = new EcumeneFunction1[String, String]("myapp.greet")
  
  def main(args: Array[String]): Unit = {
    
    // Synchronous call
    println(greet("Zizheng"))
    
    // Synchronous call with error handling
    Try(greet("Zizheng")) match {
      case Success(s) => println(s)
      case Failure(e) => println(s"ERROR: $e")
    }
    
    // Asynchronous call
    import scala.concurrent.ExecutionContext.Implicits.global
    
    val f = greet.future("Zizheng")
    f onSuccess { case s => println(s) }
    f onFailure { case e => println(s"ERROR: $e") }
    
    while (true) { Thread.sleep(500) }
  }
}

MyWorker.scala:

import io.ecumene.worker._
import io.ecumene.core.Implicits._

object MyWorker {

  val greet = new EcumeneFunctionImpl1[String, String](
    "myapp.greet", "tcp://*:5555", "tcp://127.0.0.1:5555",
    { name => name + ", welcome to Ecumene!"}
  )
  
  def main(args: Array[String]): Unit = {
    while (true) { Thread.sleep(500) }
  }
}

Then start MyWorker followed by MyClient.

License

ecumene-scala is licensed under the GNU Lesser General Public License v3.0. See the LICENSE file for details.

ecumene-scala's People

Contributors

zizhengtai avatar

Watchers

 avatar  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.