Skip to content

Latest commit

 

History

History
69 lines (43 loc) · 1.48 KB

README.md

File metadata and controls

69 lines (43 loc) · 1.48 KB

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