• Stars
    star
    597
  • Rank 72,219 (Top 2 %)
  • Language
    Java
  • License
    Apache License 2.0
  • Created over 8 years ago
  • Updated 8 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Microservices library - 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

scalecube-services

Maven Central SourceSpy Dashboard

MICROSERVICES 2.0

ScaleCube is a library that simplifies the development of reactive and distributed applications by providing an embeddable microservices library. It connects distributed microservices in a way that resembles a fabric when viewed collectively. It greatly simplifies and streamlines asynchronous programming and provides a tool-set for managing microservices architecture. ScaleCube is built based on ScaleCube Cluster, which provides a built-in service discovery. The discovery uses SWIM protocol and gossip that scales better and has inherent failure detection and superior coherent understanding of the cluster state and cluster membership taking part in a swarm of services. ScaleCube cluster is a membership protocol that maintains membership amongst processes in a distributed system

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 peers in a cluster
  • Fully Distributed with No single-point-of-failure or single-point-of-bottleneck
  • Fast - Low latency and high throughput
  • Scaleable over- cores, jvms, clusters, regions.
  • Built-in Service Discovery and service routing
  • Zero configuration, automatic peer-to-peer service discovery using SWIM cluster membership protocol
  • Simple non-blocking, asynchronous programming model
  • 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.
  • Built-in failure detection, fault tolerance, and elasticity
  • Routing and balancing strategies for both stateless and stateful services
  • Embeddable into existing applications
  • Natural Circuit-Breaker via scalecube-cluster discovery and failure detector.
  • Support Service instance tagging.
  • Support Service discovery partitioning using hierarchy of namespaces in a multi-cluster deployments.
  • Modular, flexible deployment models and topology
  • pluggable api-gateway providers (http / websocket / rsocket)
  • pluggable service transports (tcp / aeron / rsocket)
  • pluggable encoders (json, SBE, Google protocol buffers)
  • pluggable service security authentication and authorization providers.

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.
// service definition
@Service("io.scalecube.Greetings")
public interface GreetingsService {
  @ServiceMethod("sayHello")
	  Mono<Greeting> sayHello(String name);
	}
}
// service implementation
public class GreetingServiceImpl implements GreetingsService {
 @Override
 public Mono<Greeting> sayHello(String name) {
   return Mono.just(new Greeting("Nice to meet you " + name + " and welcome to ScaleCube"));
	}
}

//1. ScaleCube Node node with no members (container 1)
Microservices seed = Microservices.builder()
  .discovery("seed", ScalecubeServiceDiscovery::new)
	.transport(RSocketServiceTransport::new)
	.startAwait();

// get the address of the seed member - will be used to join any other members to the cluster.
final Address seedAddress = seed.discovery("seed").address();

//2. Construct a ScaleCube node which joins the cluster hosting the Greeting Service (container 2)
Microservices serviceNode = Microservices.builder()
  .discovery("seed", ep -> new ScalecubeServiceDiscovery(ep)
		.membership(cfg -> cfg.seedMembers(seedAddress)))
	.transport(RSocketServiceTransport::new)
	.services(new GreetingServiceImpl())
	.startAwait();

//3. Create service proxy (can be created from any node or container in the cluster)
//   and Execute the service and subscribe to incoming service events
seed.call().api(GreetingsService.class)
  .sayHello("joe").subscribe(consumer -> {
    System.out.println(consumer.message());
  });

// await all instances to shutdown.
Mono.whenDelayError(seed.shutdown(), serviceNode.shutdown()).block();

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:

Available api-gateways are rsocket, http and websocket

Basic API-Gateway example:

    Microservices.builder()
        .discovery(options -> options.seeds(seed.discoveryAddress()))
        .services(...) // OPTIONAL: services (if any) as part of this node.

        // configure list of gateways plugins exposing the apis
        .gateway(options -> new WebsocketGateway(options.id("ws").port(8080)))
        .gateway(options -> new HttpGateway(options.id("http").port(7070)))
        .gateway(options -> new RSocketGateway(options.id("rsws").port(9090)))

        .startAwait();

        // HINT: you can try connect using the api sandbox to these ports to try the api.
        // https://scalecube.github.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:

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>

Sponsored by:

We Hire at exberry.io

https://exberry.io/career/

website

https://scalecube.github.io/

More Repositories

1

scalecube-cluster

ScaleCube Cluster is a lightweight Java VM implementation of SWIM: Scalable Weakly-consistent Infection-style Process Group Membership Protocol. features cluster membership, failure detection, and gossip protocol library.
Java
243
star
2

socketio

Socket.IO Java Server based on Netty. was created to meet gaming performance requirements. battle tested and in use by Playtech Microservices API Gateway.
Java
184
star
3

scalecube-js

Toolkit for working in microservices/micro-frontends architecture.
TypeScript
67
star
4

gatling-tcp-extensions

Tcp extensions for gatling
Scala
23
star
5

scalecube-gateway

ScaleCube API Gateway is the single entry point for service consumers. handles incoming requests and proxy/route to the appropriate microservice instance.
Java
19
star
6

scalecube-config

ScaleCube Config is a configuration access management library for JVM based distributed applications
Java
16
star
7

aeron-cluster-poc

aeron cluster playground with simple distributed counter example
Java
11
star
8

robokit

JavaScript
10
star
9

socketio-examples

JavaScript
9
star
10

scalecube-security

Authentication and Authorization library for scalecube services.
Java
7
star
11

scalecube-spring-boot-starter

Java
5
star
12

getting-started

hello world examples of using scalecube to get started building high-speed reactive microservices
Java
4
star
13

scalecube-organization-service

Organizations are shared accounts where groups of people can access many applications at once. Owners and administrators can manage member access to the organization's applications with sophisticated security and administrative features.
JavaScript
4
star
14

scalecube-commons

ScaleCube fundamental data models
Java
3
star
15

scalecube-benchmarks

Benchmarks framework
Java
3
star
16

scalecube-test-utils

a test utilities package for maven based projects
Java
3
star
17

scalecube-third-party-benchmarks

Java
2
star
18

trace-reporter

Creates beautiful charts
Java
2
star
19

m2m-vault-poc

POC for M2M authorization driven by Vault Identities Secrets Engine.
Shell
2
star
20

scalecube-travis-ci

this repository contains the scripts for making the
Shell
2
star
21

scalecube-seed

Shell
1
star
22

aeron-examples

aeron-examples
Java
1
star
23

spintest

1
star
24

docs

1
star
25

scalecube-package-utils

ASCII art logo builder
Java
1
star
26

robokit-ui

JavaScript
1
star