Skip to content

hello world examples of using scalecube to get started building high-speed reactive microservices

Notifications You must be signed in to change notification settings

scalecube/getting-started

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Getting started

  1. define java service dsl using interface.
@Service("greeting")
public interface GreetingService {
  
  @ServiceMethod("once")
  Mono<String> sayHello(String name);
  
  @ServiceMethod("many")
  Flux<String> sayHellos(String name);

  @ServiceMethod("timer")
  Flux<String> timerHello(String name);
  
}
  1. implement the service dsl.
public class SimpleGreetingService implements GreetingService {

  @Override
  public Mono<String> sayHello(String name) {
    return Mono.just("greeting to: "+ name);
  }

  @Override
  public Flux<String> sayHellos(String name) {
    return Flux.range(0, 3).map(i -> "greeting to: " + name + "-" + i);
  }

  @Override
  public Flux<String> timerHello(String name) {
    return Flux.interval(Duration.ofSeconds(1)).map(i -> "greeting to: " + name + "-" + i);
  }
  
}
  1. running the service.
  • RequestResponseMain
  • RequestStreamMain
  • GreetingServiceMain and ServiceGatewayMain
  1. Api-Sandbox: 4.1. open in browser: http://scalecube.io/api-sandbox/app/index.html

4.2. click settings and choose Rsocket and set url ws://localhost:9090

image

4.3. input json request and click send:

select:

image

send: image

About

hello world examples of using scalecube to get started building high-speed reactive microservices

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages