io.scalecube:scalecube-spring-boot-starter

ScaleCube is a lightweight decentralized cluster membership, failure detection, messaging and gossip protocol library for the Java VM.

License

License

Categories

Categories

Spring Boot Container Microservices
GroupId

GroupId

io.scalecube
ArtifactId

ArtifactId

scalecube-spring-boot-starter
Last Version

Last Version

2.2.3
Release Date

Release Date

Type

Type

jar
Description

Description

ScaleCube is a lightweight decentralized cluster membership, failure detection, messaging and gossip protocol library for the Java VM.

Download scalecube-spring-boot-starter

How to add to project

<!-- https://jarcasting.com/artifacts/io.scalecube/scalecube-spring-boot-starter/ -->
<dependency>
    <groupId>io.scalecube</groupId>
    <artifactId>scalecube-spring-boot-starter</artifactId>
    <version>2.2.3</version>
</dependency>
// https://jarcasting.com/artifacts/io.scalecube/scalecube-spring-boot-starter/
implementation 'io.scalecube:scalecube-spring-boot-starter:2.2.3'
// https://jarcasting.com/artifacts/io.scalecube/scalecube-spring-boot-starter/
implementation ("io.scalecube:scalecube-spring-boot-starter:2.2.3")
'io.scalecube:scalecube-spring-boot-starter:jar:2.2.3'
<dependency org="io.scalecube" name="scalecube-spring-boot-starter" rev="2.2.3">
  <artifact name="scalecube-spring-boot-starter" type="jar" />
</dependency>
@Grapes(
@Grab(group='io.scalecube', module='scalecube-spring-boot-starter', version='2.2.3')
)
libraryDependencies += "io.scalecube" % "scalecube-spring-boot-starter" % "2.2.3"
[io.scalecube/scalecube-spring-boot-starter "2.2.3"]

Dependencies

compile (3)

Group / Artifact Type Version
io.scalecube : scalecube-spring-boot-autoconfigure jar 2.2.3
io.scalecube : scalecube-services-discovery Optional jar 2.8.10-RC2
io.scalecube : scalecube-services-transport-rsocket Optional jar 2.8.10-RC2

Project Modules

There are no modules declared in this project.

Spring Boot Scale Cube Starter

Scale Cube Spring Boot Project it easy to create Spring Boot application using Scale Cube.

Scale Cube is A Novel Open-source application-platform that addresses inherent challenges involved in the development of distributed computing.

Released version

You can introduce the latest dubbo-spring-boot-starter to your project by adding the following dependency to your pom.xml

<properties>
    <spring-boot.version>2.1.6.RELEASE</spring-boot.version>
</properties>

<dependencyManagement>
    <dependencies>
        <!-- Spring Boot -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-dependencies</artifactId>
            <version>${spring-boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
        
        <!-- Scale Cube -->
        <dependency>
            <groupId>io.scalecube</groupId>
            <artifactId>scalecube-bom</artifactId>
            <version>${spring-boot.version}</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency>
    </dependencies>
</dependencyManagement>    

<dependencies>
  <!-- Spring Boot Scale Cube Starter -->
  <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>spring-boot-starter-scalecube</artifactId>
      <version>${spring-boot.version}</version>
  </dependency>
  
  <!-- Optional. Network Transport for distributed system --> 
  <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-transport-rsocket</artifactId>
  </dependency>
  <!-- Optional. Cluster & Service Discovery for distributed system -->
  <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-discovery</artifactId>
  </dependency>

  <!-- Optional. Message codec for distributed system --> 
  <dependency>
      <groupId>io.scalecube</groupId>
      <artifactId>scalecube-services-transport-jackson</artifactId>
  </dependency>
</dependencies>

Build from Source

If you'd like to attempt to experience latest features, you also can build from source as follow:

  1. Maven install current project in your local repository.

Maven install = mvn install

Getting Started

If you don't know about Scale Cube, please take a few minutes to learn www.scalecube.io.

Usually, There are two usage scenarios for Scale Cube applications, one is Scale Cube service(s) provider, another is Scale Cube service(s) consumer, thus let's get a quick start on them.

First of all, we suppose an interface as Scale Cube Service that a service provider exports and a service client consumes:

@Service
public interface ExampleService {

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

  @ServiceMethod
  Flux<String> helloStream();

  @ServiceMethod
  Flux<MyResponse> helloBidirectional(Flux<String> nameSteam);
}

Scale Cube service(s) provider

  1. Service Provider implements ExampleService

    @Component
    public class DefaultExampleService implements ExampleService {
      
      @Override
      public Mono<String> sayHello(String name) {
        return Mono.just("Hello, " + request);
      }
      
      @Override
      public Flux<MyResponse> helloStream() {
        return Flux.just("Hello, Eugene", "Hello, Kate");
      }
      
      @Override
      public Flux<MyResponse> helloBidirectional(Flux<String> nameSteam) {
        return nameSteam.map("Hello, "::concat);
      }
    }
  2. Provides a bootstrap class

      @SpringBootApplication
      public class ScalecubeProviderDemo {
    
          public static void main(String[] args) {
              SpringApplication.run(DubboProviderDemo.class,args);
          }
      }
  3. Configures the application.yml

    spring:
      scalecube:
        discovery:
          transport:
            port: 21000  

Scale Cube Service Consumer

  1. Service Consumer must depend on ExampleService

    @Component
    public class ExampleServiceConsumer { 
    
      @SelectorStrategy(routerType = RoundRobinRouter)
      private final ExampleService exampleService;
      
      public ExampleServiceConsumer(ExampleService exampleService) {
        this.exampleService = exampleService;
      }
      
      public void printGreeting() {
        exampleService.helloStream().subscribe(System.out::println);
      }
    
    }
  2. Service Consumer also provides a bootstrap class

    @SpringBootApplication
    public class ScalecubeConsumerDemo {
    
        public static void main(String[] args) {
            SpringApplication.run(DubboProviderDemo.class,args);
        }
     
       @Bean
       public ApplicationRunner runner(ExampleServiceConsumer exampleServiceConsumer) {
           return args -> exampleServiceConsumer.printGreeting();
       }
    }
  3. Configures application.yml

    spring:
      scalecube:
        discovery:
          membership:
            seed-members:
              - localhost:21000

Getting Help

Having trouble with Scale Cube Spring Boot? We'd like to help!

io.scalecube

SCΛLΞ CUBΞ

⚛ High-Speed ⚛ Cloud-Native ⚛ Reactive Microservices ⚛

Versions

Version
2.2.3
2.2.2
2.2.2-RC4
2.2.2-RC3
2.2.2-RC1