In JDBC, we can combine more than one process as a part of the batch and then execute the batch at one time instead of executing individual queries one by one. Similar to JDBC, we can combine multiple requests together into a single HystrixCommand instance execution, as shown in the following figure:
Request-scoped and globally-scoped are the styles of request collapsing supported by Hystrix. The request-scoped collapser collects the batch per HystrixRequestContext and the globally-scoped collapse collects the batch for multiple HystrixRequestContext.
We can create the collapse implementation as an extension of HystrixCollapser. Each HystrixCollpaser accepts the following three generic types:
- BatchReturnType: This is the type of batched command response. The collapser turns multiple commands into a batch of command. Here, we will specify...