# scalecube-services **Repository Path**: mirrors_hekailiang/scalecube-services ## Basic Information - **Project Name**: scalecube-services - **Description**: 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 designed to accommodate changes. (no sidecar in a form of broker or any kind) - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: develop - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-08-08 - **Last Updated**: 2025-09-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # scalecube-services [![Build Status](https://travis-ci.org/scalecube/scalecube-services.svg?branch=develop)](https://travis-ci.org/scalecube/scalecube-services) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/5e2ee9be41f7425590313ee1b8f737d7)](https://app.codacy.com/app/ScaleCube/scalecube-services?utm_source=github.com&utm_medium=referral&utm_content=scalecube/scalecube-services&utm_campaign=badger) [![Maven Central](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api) ## 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: * [Services Overview](http://scalecube.io/services.html) * [Defining Services](http://scalecube.io/user-reference/services/DefineService.html) * [Implementing services](http://scalecube.io/user-reference/services/ServiceImplementation.html) * [Provisioning Clustered Services](http://scalecube.io/user-reference/services/ProvisionClusterServices.html) * [Consuming services](http://scalecube.io/user-reference/services/ConsumingServices.html) 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. ```java //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( self -> new ScalecubeServiceDiscovery(self) .options(opts -> opts.seedMembers(toAddress(seed.discovery().address())))) .transport(ServiceTransports::rsocketServiceTransport) .services(new GreetingServiceImpl()) .startAwait(); //3. Create service proxy GreetingsService service = seed.call().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. ```java @Service public interface ExampleService { @ServiceMethod Mono sayHello(String request); @ServiceMethod Flux helloStream(); @ServiceMethod Flux helloBidirectional(Flux requests); } ``` ## API-Gateway: Available api-gateways are [rsocket](/services-gateway-rsocket), [http](/services-gateway-http) and [websocket](/services-gateway-websocket) Basic API-Gateway example: ```java 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(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. // 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:** * scalecube-services-transport-jackson: using Jackson to encode / decode service messages. https://github.com/FasterXML * scalecube-services-transport-protostuff: using protostuff to encode / decode service messages. https://github.com/protostuff **Service discovery providers:** * scalecube-services-discovery: using scalecue-cluster do locate service Endpoint within the cluster https://github.com/scalecube/scalecube-cluster 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](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api/badge.svg)](https://maven-badges.herokuapp.com/maven-central/io.scalecube/scalecube-services-api) ```xml 2.x.x io.scalecube scalecube-services-api ${scalecube.version} io.scalecube scalecube-services ${scalecube.version} io.scalecube scalecube-services-transport-rsocket ${scalecube.version} ``` ---- ## Sponsored by [OM2](https://www.om2.com/)