Hi all
I've found a very good tutorial about
vertx and microservices. All the example can be downloaded on github.
I downloaded the sample from github and have found, that some of the microservices are using both EventBus and RESTFul API for they communication interface, for example the product microservice.
The start method clarify what I mean:
public void start(Future<Void> future) throws Exception {
super.start();
// create the service instance
ProductService productService = new ProductServiceImpl(vertx, config());
// register the service proxy on event bus
ProxyHelper.registerService(ProductService.class, vertx, productService, SERVICE_ADDRESS);
// publish the service in the discovery infrastructure
initProductDatabase(productService)
.compose(databaseOkay -> publishEventBusService(ProductService.SERVICE_NAME, SERVICE_ADDRESS, ProductService.class))
.compose(servicePublished -> deployRestService(productService))
.setHandler(future.completer());
}As you can see, the service will expose on eventbus and as rest api. Why both?
Thanks