December 2019
Intermediate to advanced
314 pages
6h 51m
English
Asynchronous programming is not a new pattern for Enterprise developers. However, when used in combination with the BulkHead policy, you can achieve a powerful fault tolerance pattern for your microservices. In a nutshell, if you annotate a method with @Asynchronous, it will be executed asynchronously on a separate thread.
In the following example, we are performing some logic in the createOrder method, which spins off some debugging in a separate thread by means of the writeSomeLogging method, which returns a CompletableFuture instance:
public void createOrder(Orders order, Customer c) { order.setCustomer(c); entityManager.persist(order); writeSomeLogging(order.getItem());}@Asynchronousprivate Future ...
Read now
Unlock full access