Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated README #533

Merged
merged 1 commit into from
Mar 18, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 18 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,14 +64,18 @@ The example provisions 2 cluster nodes and making a remote interaction.
Microservices seed = Microservices.builder().startAwait();

//2. Construct a ScaleCube node which joins the cluster hosting the Greeting Service
Microservices microservices = Microservices.builder()
.discovery(options -> options.seeds(seed.discovery().address())) // some address so its possible to join the cluster.
.services(new GreetingServiceImpl())
.startAwait();

Microservices microservices =
Microservices.builder()
.discovery(
serviceEndpoint ->
new ScalecubeServiceDiscovery(serviceEndpoint)
.options(opts -> opts.seedMembers(toAddress(seed.discovery().address()))))
.transport(ServiceTransports::rsocketServiceTransport)
.services(new GreetingServiceImpl())
.startAwait();

//3. Create service proxy
GreetingsService service = seed.call().create().api(GreetingsService.class);
GreetingsService service = seed.call().api(GreetingsService.class);

// Execute the services and subscribe to service events
service.sayHello("joe").subscribe(consumer -> {
Expand All @@ -83,7 +87,7 @@ Basic Service Example:


* RequestOne: Send single request and expect single reply
* RequestStream: Send single request and expect stream of responses.
* 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.
Expand All @@ -98,14 +102,14 @@ public interface ExampleService {

@ServiceMethod
Flux<MyResponse> helloStream();

@ServiceMethod
Flux<MyResponse> helloBidirectional(Flux<MyRequest> requests);
}

```

## API-Gateway:
## API-Gateway:

Available api-gateways are [rsocket](/services-gateway-rsocket), [http](/services-gateway-http) and [websocket](/services-gateway-websocket)

Expand All @@ -116,11 +120,11 @@ Basic API-Gateway example:
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(GatewayConfig.builder("http", HttpGateway.class).port(7070).build())
.gateway(GatewayConfig.builder("ws", WebsocketGateway.class).port(8080).build())
.gateway(GatewayConfig.builder("rsws", RSocketGateway.class).port(9090).build())

// 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();

Expand Down