ScaleCube Services is a high throughput, low latency reactive-microservices library built to scale. it features: API-Gateways, service-discovery, service-load-balancing, the architecture supports plug-and-play service communication modules and features. built to provide performance and low-latency real-time stream-processing. its open and design…
Clone or download
Latest commit 0f341b4 Jan 15, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
services-api ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-benchmarks ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-discovery ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-examples-runner ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-examples ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-clientsdk ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-common ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-http ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-rsocket ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-runner ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-tests ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-gateway-websocket ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-transport-jackson ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-transport-protostuff ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services-transport-rsocket ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
services ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
src/main/scripts + script files Jan 9, 2019
.gitignore Removed spamming Connection Closed Exception in build logs; + cosmeti… Jul 26, 2018
.travis.yml updated: travis ci configuration file Sep 5, 2018
CODE_OF_CONDUCT.md add licence and checksyle stuff Apr 18, 2018
DEVELOPMENT.md add licence and checksyle stuff Apr 18, 2018
LICENSE.txt add licence and checksyle stuff Apr 18, 2018
README.md Update README.md Jan 15, 2019
pom.xml ++++ Prepare for next development iteration build: 4002 ++++ Jan 15, 2019
requirements.txt + script files Dec 12, 2018
travis-settings.xml Added docker support Sep 4, 2018

README.md

scalecube-services

Build Status Codacy Badge Maven Central

MICROSERVICES 2.0

An open-source project that is focused on streamlining reactive-programming of Microservices Reactive-systems that scale, built by developers for developers.

ScaleCube Services provides a low latency Reactive Microservices library for peer-to-peer service registry and discovery based on gossip protocol, without single point-of-failure or bottlenecks.

Scalecube more gracefully address the cross cutting concernes of distributed microservices architecture.

ScaleCube Services Features:
  • Provision and interconnect microservices as a service-mesh (cluster)
  • Reactive Streams support.
    • Fire And Forget - Send and not wait for a reply
    • Request Response - Send single request and expect single reply
    • Request Stream - Send single request and expect stream of responses.
    • Request bidirectional - send stream of requests and expect stream of responses.
  • No single-point-of-failure or single-point-of-bottleneck
  • Cluster aware and distributed
  • Modular, flexible deployment models and topology
  • Zero configuration, automatic peer-to-peer service discovery using gossip
  • Simple non-blocking, asynchronous programming model
  • Resilient due to failure detection, fault tolerance, and elasticity
  • Routing and balancing strategies for both stateless and stateful services
  • Low latency and high throughput
  • Takes advantage of the JVM and scales over available cores
  • Embeddable to existing Java applications
  • Natural Circuit-Breaker due to tight integration with scalecube-cluster failure detector.
  • Support Service instance tagging.
  • pluggable api-gateway providers (http / websocket / rsocket)
  • pluggable service transport
  • pluggable encoders

User Guide:

Basic Usage:

The example provisions 2 cluster nodes and making a remote interaction.

  1. seed is a member node and provision no services of its own.
  2. then microservices variable is a member that joins seed member and provision GreetingService instance.
  3. finally from seed node - create a proxy by the GreetingService api and send a greeting request.
    //1. ScaleCube Node node with no members
    Microservices seed = Microservices.builder().startAwait();

    //2. Construct a ScaleCube node which joins the cluster hosting the Greeting Service
    Microservices microservices = Microservices.builder()
        .discovery(options -> options.seeds(seed.discovery().address())) // some address so its possible to join the cluster.
        .services(new GreetingServiceImpl())
        .startAwait();


    //3. Create service proxy
    GreetingsService service = seed.call().create().api(GreetingsService.class);

    // Execute the services and subscribe to service events
    service.sayHello("joe").subscribe(consumer -> {
      System.out.println(consumer.message());
    });

Basic Service Example:

  • RequestOne: Send single request and expect single reply
  • RequestStream: Send single request and expect stream of responses.
  • RequestBidirectional: send stream of requests and expect stream of responses.

A service is nothing but an interface declaring what methods we wish to provision at our cluster.

@Service
public interface ExampleService {

  @ServiceMethod
  Mono<String> sayHello(String request);

  @ServiceMethod
  Flux<MyResponse> helloStream();
  
  @ServiceMethod
  Flux<MyResponse> helloBidirectional(Flux<MyRequest> requests);
}

API-Gateway:

api gateway plugins are managed at: https://github.com/scalecube/scalecube-gateway

Basic API-Gateway example:

    Microservices.builder()
        .discovery(options -> options.seeds(seed.discovery().address()))
        .services(...) // OPTIONAL: services (if any) as part of this node.
        
        // configure list of gateways plugins exposing the apis 
        .gateway(GatewayConfig.builder("http", HttpGateway.class).port(7070).build())
        .gateway(GatewayConfig.builder("ws", WebsocketGateway.class).port(8080).build())
        .gateway(GatewayConfig.builder("rsws", RSocketGateway.class).port(9090).build())  
        
        .startAwait();
        
        // HINT: you can try connect using the api sandbox to these ports to try the api.
        // http://scalecube.io/api-sandbox/app/index.html

Maven

With scalecube-services you may plug-and-play alternative providers for Transport,Codecs and discovery. Scalecube is using ServiceLoader to load providers from class path,

You can think about scalecube as slf4j for microservices - Currently supported SPIs:

Transport providers:

  • scalecube-services-transport-rsocket: using rsocket to communicate with remote services.

Message codec providers:

Service discovery providers:

Service API-Gateway providers:

releases: https://github.com/scalecube/scalecube-gateway/releases

  • HTTP-Gateway - scalecube-services-gateway-http
  • RSocket-Gateway - scalecube-services-gateway-rsocket
  • WebSocket - scalecube-services-gateway-websocket

Binaries and dependency information for Maven can be found at http://search.maven.org.

https://mvnrepository.com/artifact/io.scalecube

To add a dependency on ScaleCube Services using Maven, use the following:

Maven Central

 <properties>
   <scalecube.version>2.x.x</scalecube.version>
 </properties>

 <!-- -------------------------------------------
   scalecube core and api:   
 ------------------------------------------- -->

 <!-- scalecube apis   -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services-api</artifactId>
  <version>${scalecube.version}</version>
 </dependency>
 
 <!-- scalecube services module   -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services</artifactId>
  <version>${scalecube.version}</version>
 </dependency>
 

 <!--

     Plugins / SPIs: bellow a list of providers you may choose from. to constract your own configuration:
     you are welcome to build/contribute your own plugins please consider the existing ones as example.

  -->

 <!-- scalecube transport providers:  -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services-transport-rsocket</artifactId>
  <version>${scalecube.version}</version>
 </dependency>
 
 <!-- 
   scalecube message serialization providers:
   -->

 <!-- jackson scalecube messages codec -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services-transport-jackson</artifactId>
  <version>${scalecube.version}</version>
 </dependency>

<!-- protostuff scalecube messages codec -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services-transport-protostuff</artifactId>
  <version>${scalecube.version}</version>
 </dependency>

 <!--
    scalecube service discovery provider   
   -->
 <dependency>
  <groupId>io.scalecube</groupId>
  <artifactId>scalecube-services-discovery</artifactId>
  <version>${scalecube.version}</version>
 </dependency>



 <!--
    scalecube api-gateway providers:
   -->
   
  <!-- HTTP https://mvnrepository.com/artifact/io.scalecube/scalecube-services-gateway-http-->
  <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-gateway-http</artifactId>
      <version>${scalecube.version}</version>
    </dependency>

    <!-- RSocket WebSocket https://mvnrepository.com/artifact/io.scalecube/scalecube-services-gateway-rsocket -->
    <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-gateway-rsocket</artifactId>
      <version>${scalecube.version}</version>
    </dependency>

    <!-- WebSocket https://mvnrepository.com/artifact/io.scalecube/scalecube-services-gateway-websocket -->
    <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-gateway-websocket</artifactId>
      <version>${scalecube.version}</version>
    </dependency>