In this exercise you will deploy your 'My-Web-API' service to OpenShift.
Step 1: Change the Endpoint URL
Once the service is running on Kubernetes or OpenShift, it can access other services easily via DNS, for example in our case via http://articles-reactive:8080/. In that case the traffic only occurs
packageorg.acme.rest.json;importorg.eclipse.microprofile.config.inject.ConfigProperty;importorg.eclipse.microprofile.rest.client.RestClientBuilder;importjavax.annotation.PostConstruct;importjavax.enterprise.context.ApplicationScoped;importjavax.ws.rs.core.UriBuilder;importjava.net.URI;importjava.util.List;importjava.util.concurrent.CompletionStage;importjava.util.concurrent.TimeUnit;@ApplicationScopedpublicclassArticlesDataAccess {privatestaticfinalint MAXIMAL_DURATION =5000;// this configuration needs to be used when running the code in OpenShiftprivatestaticString urlArticlesServiceLocal ="http://articles-reactive:8080/v2/articles?amount=10";privateArticlesService articlesService; @PostConstructvoidinitialize() {URI apiUrl =UriBuilder.fromUri(urlArticlesServiceLocal).build(); articlesService =RestClientBuilder.newBuilder().baseUri(apiUrl).register(ExceptionMapperArticles.class).build(ArticlesService.class); }publicCompletionStage<List<Article>> getArticlesReactive(int amount) {returnarticlesService.getArticlesFromService(amount); }}