Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/scalecube/scalecube-services

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
https://github.com/scalecube/scalecube-services

actor-model aeron api-gateway backpressure cluster cluster-membership distributed-systems gossip-protocol ipc k8s low-latency microservices multicast-streams reactive-microservices reactive-streams reactor-aeron reactor-netty service-discovery service-mesh swim-protocol

Last synced: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

# scalecube-services
[![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)
[![SourceSpy Dashboard](https://sourcespy.com/shield.svg)](https://sourcespy.com/github/scalecubescalecubeservices/)

## MICROSERVICES 2.0

ScaleCube is a microservices library designed for high throughput and lower latency, catering to scalable and reactive system needs. It excels in API gateway integration, service discovery, and load balancing, employing the SWIM protocol for efficient cluster management. Its modular architecture supports various pluggable communication modules, enabling seamless and flexible deployments. With a focus on real-time stream processing and fault tolerance, ScaleCube ensures optimal performance and reliability for distributed microservices environments.

Reactive microservices communicate via streams, utilising asynchronous data flows to exchange information between services. This approach enhances system responsiveness and scalability by allowing services to process and react to data as it arrives, without blocking operations.

In practice, this involves using technologies and protocols that support reactive streams, such as Reactor. These tools enable the development of highly responsive, resilient systems capable of handling dynamic workloads efficiently.



A fully mesh, brokerless architecture is particularly beneficial for high-performing, reliable, and scalable applications.

It ensures continuous availability and responsiveness, making it ideal for real-time data processing, large-scale distributed systems, and environments where minimizing latency matters.



ScaleCube’s fully mesh architecture delivers a robust, efficient, and scalable solution for modern microservices applications, enhancing system performance and reliability without the need for complex middleware setups.



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:

* [Services Overview](http://scalecube.github.io/services.html)
* [Defining Services](http://scalecube.github.io/user-reference/services/DefineService.html)
* [Implementing services](http://scalecube.github.io/user-reference/services/ServiceImplementation.html)
* [Provisioning Clustered Services](http://scalecube.github.io/user-reference/services/ProvisionClusterServices.html)
* [Consuming services](http://scalecube.github.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
// service definition
@Service("io.scalecube.Greetings")
public interface GreetingsService {
@ServiceMethod("sayHello")
Mono sayHello(String name);
}
}
// service implementation
public class GreetingServiceImpl implements GreetingsService {
@Override
public Mono 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.

```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.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:**

* 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/)
* [exberry.io](https://exberry.io/)

### We Hire at exberry.io
https://exberry.io/career/

### website
https://scalecube.github.io/