View on GitHub

ScaleCube Reactive Microservices

The Future is reactive - The Future is right here!

Implementing services

Implementing a service is simple as simple as implementing the service interface. as you can see its pure java so your model and implementation stays clean. one more benefit of such approach comes when testing your service, building the service is just like building any java component.

for example:

public class GreetingServiceImpl implements GreetingService {
 @Override
 public CompletableFuture<GreetingResponse> greeting(GreetingRequest request) {
   return CompletableFuture.completedFuture(
     new GreetingResponse("Hello " + request.name())
   );
 }
}

Java Class

The service is a simple java class with one or more service methods. a service method may return java-8 CompletableFuture or void in case no result is expected. Service requests might be a local or remote call and should not block the service consumer (unless the consumer explicitly called the future.get() method).