Example

The following example illustrates how to create a simple a gateway aggregation using Spring Cloud and RxJava implementations. As shown here, we have a /gateway, that exposes the /v1/shops API. This API gets the list of shops and their details by calling the asset service and finally, gets the details of the analytics by calling the analytics service. This implementation uses RxJava's Observable implemented by Netflix:

@RestController@RequestMapping(value = "/gateway")public class ApiGatewayController {    private static final Logger logger = LoggerFactory.getLogger(ApiGatewayController.class);    private static final ObjectMapper objectMapper = new ObjectMapper();    private static Boolean isCloudDeployed = null;    @Autowired HttpServletRequest ...

Get Industrial Internet Application Development now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.